select('count(id) count, min(id) min, max(id) max,') ->where(['statu' => 3, 'type' => 1]) ->andWhere(['not', ['currency' => 'USDT']]) ->andWhere(['>', 'id', $last]) ->asArray() ->one(); $count = isset($query['count']) ? $query['count'] : 0; $maxId = isset($query['max']) ? $query['max'] : 0; $minId = isset($query['min']) ? $query['min'] : 0; if ($count > 0) { $min = $lastMinId == 0 ? $minId : max($lastMinId, $minId); Cache::setData('weChat_tb_min', $min); Cache::setData('weChat_tb_last', $maxId); Cache::setData('weChat_tb_history', $count + $history); $msg = "新增申请数: $count\n" . "历史未确认: $history\n" . "流水编号范围:\n" . " $min ~ $maxId\n"; $chat = Yii::$app->getWeChat()->compose(); $chat->setSendType(4); $chat->setMessageType(5); $chat->setParam('count', $count + $history); $chat->setParam('maxId', $maxId); $chat->setParam('minId', $min); $chat->setUrl($this->domain . '/chat/finance-confirm?access=lhBub4yhASfXNnOhhkxBVRBuSiVG2a&handle=auto&type=tb'); $chat->setTo($this->groupChat); $chat->setTitle('新提币申请'); $chat->setSendBody($msg); $chat->send(); } else { echo "no data"; } } /** * 提款提示 * @author: libingke */ public function actionCash() { if (Cache::getData('weChat_tk_open') != 1) { return; } $history = Cache::getData('weChat_tk_history'); $history = is_numeric($history) ? $history : 0; $lastMinId = Cache::getData('weChat_tk_min'); $lastMinId = is_numeric($lastMinId) ? $lastMinId : 0; $last = Cache::getData('weChat_tk_last'); $last = is_numeric($last) ? $last : 0; $maxImport = CashRecord::find() ->select('max(id)') ->where(['statu' => 7, 'type' => 1]) ->andWhere(['>', 'id', $last]) ->asArray() ->scalar(); $newLast = max($maxImport, (string)$lastMinId); $query = CashRecord::find() ->select('count(id) count, min(id) min, max(id) max,') ->where(['statu' => 6, 'type' => 1]) ->andWhere(['>', 'id', $newLast]) ->asArray() ->one(); $count = isset($query['count']) ? $query['count'] : 0; $maxId = isset($query['max']) ? $query['max'] : 0; $minId = isset($query['min']) ? $query['min'] : 0; if ($count > 0) { $min = $lastMinId == 0 ? $minId : max($lastMinId, $minId); Cache::setData('weChat_tk_min', $min); Cache::setData('weChat_tk_last', $maxId); Cache::setData('weChat_tk_history', $count + $history); $msg = "新增申请数: $count\n" . "历史未确认: $history\n" . "流水编号范围:\n" . " $min ~ $maxId\n"; $chat = Yii::$app->getWeChat()->compose(); $chat->setSendType(4); $chat->setMessageType(5); $chat->setParam('count', $count); $chat->setParam('maxId', $maxId); $chat->setParam('minId', $minId); $chat->setUrl($this->domain . '/chat/finance-confirm?access=lhBub4yhASfXNnOhhkxBVRBuSiVG2a&handle=auto&type=tk'); $chat->setTo($this->groupChat); $chat->setTitle('¥ 新提款申请'); $chat->setSendBody($msg); $chat->send(); } else { echo "no data"; } } }