Commit 2fdd5f9c authored by pengfei's avatar pengfei

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

parent 3272229f
......@@ -12,6 +12,9 @@ class ColonelDistributorPayInfo extends MysqlBase
const TYPE_NEW_USER = 1;
const TYPE_FINISH_TARGET = 2;
const STATUS_NOT_USE = 0;
const STATUS_USE = 1;
public static $typeDesc = [
self::TYPE_NEW_USER => "邀请新用户",
......
......@@ -25,9 +25,10 @@ class ColonelwalletController extends Cli
$payInfoList = $this->getPayInfo($yesterday);
if (!empty($payInfoList)) {
$res = $this->toWallet($payInfoList);
if ($res) {
$this->deductingInventory($payInfoList);
if ($this->toWallet($payInfoList)) {
if ($this->deductingInventory($payInfoList)) {
$this->handlePayInfoStatus(array_column($payInfoList,'colonel_distributor_pay_info_id'));
}
}
}
......@@ -40,7 +41,7 @@ class ColonelwalletController extends Cli
*/
public function getPayInfo($date)
{
$list = ColonelDistributorPayInfo::select("*", ["date" => $date], []);
$list = ColonelDistributorPayInfo::select("*", ["date" => $date,'status' => ColonelDistributorPayInfo::STATUS_NOT_USE], []);
$data = [];
if (!empty($list)) {
foreach ($list as $item) {
......@@ -112,7 +113,7 @@ class ColonelwalletController extends Cli
$tmp["amount"] = $payInfo["reward"];
$data["body"][] = $tmp;
}
$res = HttpUtil::post($url, $data);
$res = HttpUtil::post($url, $data,100000,3);
if ($res['code'] == 0 && isset($res['response']["result"])) {
$date = date("Y-m-d H:i:s");
FileLog::info("colonel_distributor_deducting_inventory", $date." 资金池授予用户奖励成功");
......@@ -123,4 +124,12 @@ class ColonelwalletController extends Cli
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