Commit 2fdd5f9c authored by pengfei's avatar pengfei

update 团长分销-奖励钱包脚本增加状态

parent 3272229f
...@@ -12,6 +12,9 @@ class ColonelDistributorPayInfo extends MysqlBase ...@@ -12,6 +12,9 @@ class ColonelDistributorPayInfo extends MysqlBase
const TYPE_NEW_USER = 1; const TYPE_NEW_USER = 1;
const TYPE_FINISH_TARGET = 2; const TYPE_FINISH_TARGET = 2;
const STATUS_NOT_USE = 0;
const STATUS_USE = 1;
public static $typeDesc = [ public static $typeDesc = [
self::TYPE_NEW_USER => "邀请新用户", self::TYPE_NEW_USER => "邀请新用户",
......
...@@ -25,9 +25,10 @@ class ColonelwalletController extends Cli ...@@ -25,9 +25,10 @@ class ColonelwalletController extends Cli
$payInfoList = $this->getPayInfo($yesterday); $payInfoList = $this->getPayInfo($yesterday);
if (!empty($payInfoList)) { if (!empty($payInfoList)) {
$res = $this->toWallet($payInfoList); if ($this->toWallet($payInfoList)) {
if ($res) { if ($this->deductingInventory($payInfoList)) {
$this->deductingInventory($payInfoList); $this->handlePayInfoStatus(array_column($payInfoList,'colonel_distributor_pay_info_id'));
}
} }
} }
...@@ -40,7 +41,7 @@ class ColonelwalletController extends Cli ...@@ -40,7 +41,7 @@ class ColonelwalletController extends Cli
*/ */
public function getPayInfo($date) public function getPayInfo($date)
{ {
$list = ColonelDistributorPayInfo::select("*", ["date" => $date], []); $list = ColonelDistributorPayInfo::select("*", ["date" => $date,'status' => ColonelDistributorPayInfo::STATUS_NOT_USE], []);
$data = []; $data = [];
if (!empty($list)) { if (!empty($list)) {
foreach ($list as $item) { foreach ($list as $item) {
...@@ -112,7 +113,7 @@ class ColonelwalletController extends Cli ...@@ -112,7 +113,7 @@ class ColonelwalletController extends Cli
$tmp["amount"] = $payInfo["reward"]; $tmp["amount"] = $payInfo["reward"];
$data["body"][] = $tmp; $data["body"][] = $tmp;
} }
$res = HttpUtil::post($url, $data); $res = HttpUtil::post($url, $data,100000,3);
if ($res['code'] == 0 && isset($res['response']["result"])) { if ($res['code'] == 0 && isset($res['response']["result"])) {
$date = date("Y-m-d H:i:s"); $date = date("Y-m-d H:i:s");
FileLog::info("colonel_distributor_deducting_inventory", $date." 资金池授予用户奖励成功"); FileLog::info("colonel_distributor_deducting_inventory", $date." 资金池授予用户奖励成功");
...@@ -123,4 +124,12 @@ class ColonelwalletController extends Cli ...@@ -123,4 +124,12 @@ class ColonelwalletController extends Cli
return false; return false;
} }
} }
/**
* 修改状态
*/
public function handlePayInfoStatus(array $payInfoIds)
{
return ColonelDistributorPayInfo::updateRecord(['status' => ColonelDistributorPayInfo::STATUS_USE],['id' => $payInfoIds]);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment