'待审核', Cash::STATUS_CONFIRM => '待打款', Cash::STATUS_GIVEN => '已打款', Cash::STATUS_REFUSE => '驳回', Cash::STATUS_RECHARGE => '余额通过', ]; const TYPE_TEXT = [ Cash::TYPE_WX => '微信', Cash::TYPE_ALIPAY => '支付宝', Cash::TYPE_BANK => '银行卡', Cash::TYPE_RECHARGE => '余额' ]; const PAY_TYPE_TEXT = [ Cash::PAY_TYPE_NO => '未统计', Cash::PAY_TYPE_WX => '微信自动打款', Cash::PAY_TYPE_HAND => '手动拨款' ]; const CAHS_TYPE = [ Cash::IS_CASH_TYPE_SHARE => '非自提点', Cash::IS_CASH_TYPE_SHOP => '自提点' ]; public $pay_wechat; public $pay_alipay; public $bank; public $lg; public $remaining_sum; public $cash_service_charge; public $min_money; public $cash_max_single_day; public $cash_max_day; public $cash_price_type; public $cash_price_amount; public $cash_price_balance; public $cash_price_integral; public $auto_money; /** * {@inheritdoc} */ public function rules() { return [ [['id', 'user_id', 'saas_id','store_id', 'status', 'is_delete', 'pay_time', 'type', 'pay_type', 'cash_type', 'brands_id'], 'integer'], [['price', 'service_charge'], 'number'], [['keyword', 'flag'], 'trim'], [['mobile', 'name', 'order_no', 'keyword', 'dateStart', 'dateEnd', 'cash_price_type'], 'string', 'max' => 255], [['bank_name', 'flag'], 'string', 'max' => 30], ['is_delete', 'default', 'value'=> Cash::IS_DELETE_NO], ['type', 'default', 'value'=> Cash::TYPE_WX], ['status', 'default', 'value'=> Cash::STATUS_APPLY], ['pay_type', 'default', 'value'=> Cash::PAY_TYPE_NO], ['cash_type', 'default', 'value'=> Cash::IS_CASH_TYPE_SHARE], [['fields'], 'safe'], // 操作 [['name', 'pic_url', 'total_num', 'expire_day', 'money', 'price', 'sort'],'required', 'on'=> [self::SCENARIO_ADD, self::SCENARIO_EDIT]], // [['id'],'required', 'on'=> [self::SCENARIO_DEL, self::SCENARIO_EDIT]], [['key', 'action'], 'required', 'on'=> self::SCENARIO_ACTION], ['search_key', 'string', 'on' => self::SCENARIO_LIST], [['mch', 'mch_id', 'mch_common_cat_id'], 'safe'], [['export'], 'safe'], [['pay_alipay', 'pay_wechat', 'bank', 'remaining_sum', 'lg'], 'in', 'range' => [0, 1]], [['cash_service_charge', 'min_money', 'cash_max_single_day', 'cash_max_day', 'cash_price_amount', 'cash_price_balance', 'cash_price_integral', 'auto_money'], 'number'], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'user_id' => '用户id', 'store_id' => '商城id', 'price' => '提现金额', 'status' => '申请状态 0--申请中 1--确认申请 2--已打款 3--驳回 5--余额通过', 'is_delete' => '是否删除', 'pay_time' => '付款', 'type' => '支付方式 0--微信支付 1--支付宝 2--银行卡 3--余额', 'mobile' => '支付宝账号', 'name' => '支付宝姓名', 'bank_name' => '开户行名称', 'pay_type' => '打款方式 0--之前未统计的 1--微信自动打款 2--手动打款', 'order_no' => '微信自动打款订单号', 'service_charge' => '提现手续费', 'cash_type' => '0、正常,1、自提点提现', ]; } public function scenarios() { $scenarios = parent::scenarios(); return $scenarios; } public function saveCash() { if ($this->validate()) { $t = \Yii::$app->db->beginTransaction(); if ($this->scenario == self::SCENARIO_EDIT) { $model = Cash::findOne(['id' => $this->id]); } else { $model = new Cash(); } $model->attributes = $this->attributes; if (!$model->save()) { $t->rollBack(); return [ 'code' => 1, 'msg' => $model->getErrorSummary(false)[0] ]; } $t->commit(); return [ 'code' => 0, 'msg' => '保存成功' ]; } else { // 验证失败:$errors 是一个包含错误信息的数组 return [ 'code' => 1, "msg" => $this->getErrorSummary(false)[0] ]; } } public function searchShopCash() { $query = Cash::find()->alias('c') ->leftJoin(['u' => User::tableName()], "u.id=c.user_id") ->select("c.*, u.nickname user_name, u.avatar_url user_head_url"); $query->where(['c.is_delete' => Cash::IS_DELETE_NO, 'cash_type' => Cash::IS_CASH_TYPE_SHOP])->orderBy("id desc"); // 搜索 if ($this->search_key) { $query->andWhere([ 'or', ['like', 'u.nickname', $this->search_key], ['like', 'c.name', $this->search_key] ]); } if ($this->status == 0 and $this->status != '') {//待审核 $query->andWhere(['c.status' => 0]); } if ($this->status == 1) {//待打款 $query->andWhere(['c.status' => 1]); } if ($this->status == 2) {//已打款 $query->andWhere(['in', 'c.status', [2, 5]]); } if ($this->status == 3) {//无效 $query->andWhere(['c.status' => 3]); } if ($this->flag == Export::EXPORT) { $export = new ExportList(); $data = $query->orderBy('c.status ASC,c.created_at DESC')->select(['c.*', 'u.nickname', 'u.avatar_url','u.platform', 'u.id user_id'])->asArray()->all(); $export->shareExportData($data, $this->fields); } $list = pagination_make($query); foreach ($list['list'] as &$val) { $val['created_at'] = date('Y-m-d H:i:s', $val['created_at']); $val['status_text'] = self::STATUS_TEXT[$val['status']]; $val['type_text'] = self::TYPE_TEXT[$val['type']]; $val['pay_type_text'] = self::PAY_TYPE_TEXT[$val['pay_type']]; // $val['is_shop_text'] = self::CAHS_TYPE[$val['is_shop']]; } return [ 'code' => 0, 'msg' => 'success', 'data' => [ 'export_list' => $this->getCustomField(), 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'] ] ]; } public function delCash() { if ($this->validate()) { $t = \Yii::$app->db->beginTransaction(); if ($this->scenario !== self::SCENARIO_DEL) { return [ 'code' => 1, 'msg' => '删除失败' ]; } $model = Cash::findOne(['id' => $this->key]); $model->is_delete = Cash::IS_DELETE_YES; if (!$model || !$model->save()) { $t->rollBack(); return [ 'code' => 1, 'msg' => $model->getErrorSummary(false)[0] ]; } $t->commit(); return [ 'code' => 0, 'msg' => '删除成功' ]; // 所有输入数据都有效 all inputs are valid } else { // 验证失败:$errors 是一个包含错误信息的数组 return [ 'code' => 1, "msg" => $this->getErrorSummary(false)[0] ]; } } /** * 获取分销提现列表 * @return array */ public function getShareCashList() { $query = Cash::find()->alias('c') ->where(['c.is_delete' => Cash::IS_DELETE_NO, 'c.store_id' => $this->store_id]) ->leftJoin('{{%user}} u', 'u.id=c.user_id'); if ($this->cash_type == Cash::IS_CASH_TYPE_SHARE) { $query->leftJoin('{{%share}} s', 's.user_id=c.user_id'); $query->andWhere(['s.is_delete' => Share::SHARE_NOT_DELETE, 'u.is_distributor' => User::IS_DISTRIBUTOR]); } $query->andWhere(['c.cash_type' => $this->cash_type ? $this->cash_type : Cash::IS_CASH_TYPE_SHARE]); if ($this->keyword) { if ($this->cash_type == Cash::IS_CASH_TYPE_SHARE) { $query->andWhere([ 'or', ['like', 'u.nickname', $this->keyword], ['like', 's.name', $this->keyword] ]); } else { $query->andWhere(['like', 'u.nickname', $this->keyword]); } } if (isset($this->mch) && $this->mch == 1) { if ($this->mch_id > 0) { $query->andWhere(['c.mch_id' => $this->mch_id]); }else{ $query->andWhere(['>', 'c.mch_id', 0]); } if($this->brands_id > 0){ $mchList = Mch::find()->where(['is_delete' => 0, 'store_id' => get_store_id(), 'brands_id' => $this->brands_id])->select('id')->column(); $query->andWhere(['c.mch_id' => $mchList]); } if (isset($this->mch_common_cat_id) && $this->mch_common_cat_id > 0) { $query->andWhere(['c.mch_id' => \app\models\Mch::find()->select('id')->where(['store_id' => $this->store_id, 'mch_common_cat_id' => $this->mch_common_cat_id])]); } }else{ $query->andWhere(['c.mch_id' => 0]); } if ($this->dateStart) { $query->andWhere(['>=', 'c.created_at', strtotime($this->dateStart)]); } if ($this->dateEnd) { $query->andWhere(['<=', 'c.created_at', strtotime($this->dateEnd)]); } if ($this->status == Cash::STATUS_APPLY and $this->status != '') {//待审核 $query->andWhere(['c.status' => Cash::STATUS_APPLY]); } if ($this->status == Cash::STATUS_CONFIRM) {//待打款 // $query->andWhere(['c.status' => Cash::STATUS_CONFIRM]); $query->andWhere(['in', 'c.status', [Cash::STATUS_CONFIRM, Cash::STATUS_LG_CONFIRM]]); } if ($this->status == Cash::STATUS_GIVEN) {//已打款 $query->andWhere(['in', 'c.status', [Cash::STATUS_GIVEN, Cash::STATUS_HAND, Cash::STATUS_RECHARGE]]); } if ($this->status == Cash::STATUS_REFUSE) {//无效 $query->andWhere(['c.status' => Cash::STATUS_REFUSE]); } if ($this->id) { $query->andWhere(['s.id' => $this->id]); } if (isset($this->type) && $this->type > -1) { $query->andWhere(['c.type' => $this->type]); } if ($this->flag == Export::EXPORT) { $export = new ExportList(); $data = $query->orderBy('id DESC') ->select(['c.*', 'u.nickname', 'u.avatar_url','u.platform', 'u.id user_id'])->asArray()->all(); $export->shareExportData($data, $this->fields); } $query->distinct()->orderBy('id DESC')->select([ 'c.*', 'u.nickname','u.platform', 'u.avatar_url','u.binding' ]); $pagination = pagination_make($query); $list = $pagination['list']; if($this->cash_type == Cash::IS_CASH_TYPE_MCH){ $mchList = (new MchForm(['store_id' => $this->store_id]))->mchSelectList(); $mchCommonCatSelectList = (new MchForm(['store_id' => $this->store_id]))->mchCommonCatSelectList(); } $wechat = \Yii::$app->controller->wechatPay; try { $Wxv3 = (new \app\utils\WechatMerchant\WxV3($wechat)); } catch (\Exception $e) { $Wxv3 = null; } foreach($list as &$value){ // if (intval($value['pay_type']) === 1) { // \app\events\OrderEvent::handleWechatCashFail($Wxv3, $this->store_id, $value['order_no']); // } $value['wx_cash_status'] = intval($value['wx_cash_status']); $value['type_name'] = Cash::getTypeName($value); $value['status_name'] = Cash::getCashStatusName($value); $value['service_money'] = $value['service_charge'] * $value['price'] / 100; $value['created_at'] = date('Y-m-d H:i:s', $value['created_at']); $value['updated_at'] = !empty($value['updated_at']) ? date('Y-m-d H:i:s', $value['updated_at']) : ''; $value['money'] = Cash::getServiceMoney($value); $saas_user = SaasUser::findOne(['mobile' => $value['binding']]); $value['avatar_url'] = !empty($saas_user['avatar']) ? $saas_user['avatar'] : $value['avatar_url']; $value['card_no'] = ''; if (intval($value['type']) === Cash::TYPE_BANK) { if ($saas_user->withdraw_method) { $withdraw_method = json_decode($saas_user->withdraw_method, true); if (!empty($withdraw_method)) { foreach ($withdraw_method as $method_item) { if ($method_item['type'] === 'bank_card') { $value['card_no'] = $method_item['card_no']; } } } } } if($this->cash_type == Cash::IS_CASH_TYPE_MCH){ $value['mch'] = $mchList['data'][$value['mch_id']]; $value['mch_common_cat'] = $mchCommonCatSelectList['data'][$value['mch']['mch_common_cat_id']]; } $cashExtArr = CashExt::find()->where(['cash_id' => $value['id']])->select('cash_price_type, real_price')->asArray()->all(); $value['cash_ext_text'] = null; if ($cashExtArr) { $value['cash_ext_text'] = '提现明细:'; foreach ($cashExtArr as $cashExtItem) { $value['cash_ext_text'] .= CashExt::$cashPriceTypeMap[$cashExtItem['cash_price_type']] . ':' . $cashExtItem['real_price'] . ';'; } } $value['integral_appreciation_num'] = 0; $value['integral_appreciation_price'] = 0; if (intval($value['cash_type']) === Cash::IS_CASH_TYPE_INTEGRAL_APPRECIATION) { $integralCashLog = IntegralAppreciationCashLog::findOne(['cash_id' => $value['id']]); $value['integral_appreciation_num'] = $integralCashLog->integral ?: 0; $value['integral_appreciation_price'] = $integralCashLog->integral_price ?: 0; } } if($this->export){ return $this->export($list); } return [ 'code' => 0, 'msg' => 'success', 'data' => [ 'q' => $query->createCommand()->getRawSql(), 'export_list' => $this->getCustomField(), 'data' => $list, 'pageNo' => $pagination['pageNo'], 'totalCount' => $pagination['totalCount'] ], ]; } private function export($list) { $rows = [[ 'ID', '入驻商', '会员信息', '手机号', '申请提现金额(元)', '手续费(元)', '实际打款(元)', '姓名', '提现到', '账户', '开户行', '状态', '申请时间', '审核时间', ]]; foreach($list as $item){ $r = [ $item['id'], $item['mch'] ? $item['mch']['name'] : '', $item['nickname'], $item['binding'], $item['price'], $item['service_money'], $item['money'], $item['name'], Cash::$type[$item['type']] ?? '--', $item['mobile'], $item['bank_name'], Cash::$status[$item['status']] ?? '', $item['created_at'], $item['updated_at'], ]; $rows[] = $r; } $writer = \Spatie\SimpleExcel\SimpleExcelWriter::streamDownload(time() . '.xlsx')->noHeaderRow() ->addRows($rows)->toBrowser(); } /** * 用户分销提现列表 */ public function shareCashUserList() { if ($this->user_id) { $query = Cash::find()->alias('c') ->where(['c.is_delete' => Cash::IS_DELETE_NO, 'c.store_id' => $this->store_id, 'c.user_id' => $this->user_id]) ->leftJoin('{{%user}} u', 'u.id=c.user_id') ->leftJoin('{{%share}} s', 's.user_id=c.user_id') ->andWhere(['s.is_delete' => Share::SHARE_NOT_DELETE, 'u.is_distributor' => User::IS_DISTRIBUTOR, 'c.cash_type' => Cash::IS_CASH_TYPE_SHARE]); $query->distinct()->orderBy('c.status ASC,c.created_at DESC')->select([ 'c.*', 'u.nickname','u.platform', 'u.avatar_url','u.binding' ]); $pagination = pagination_make($query); $list = $pagination['list']; foreach($list as &$value){ $value['service_money'] = $value['service_charge'] * $value['price'] / 100; $value['created_at'] = date('Y-m-d H:i:s', $value['created_at']); $value['updated_at'] = !empty($value['updated_at']) ? date('Y-m-d H:i:s', $value['updated_at']) : ''; $value['money'] = Cash::getServiceMoney($value); $sassuser = SaasUser::findOne(['mobile' => $value['binding']]); $value['avatar_url'] = !empty($sassuser['avatar']) ? $sassuser['avatar'] : $value['avatar_url']; } return [ 'code' => 0, 'msg' => 'success', 'data' => [ 'export_list' => $this->getCustomField(), 'data' => $list, 'pageNo' => $pagination['pageNo'], 'totalCount' => $pagination['totalCount'] ], ]; } else { return [ 'code' => 0, 'msg' => '缺少参数', ]; } } /** * saas用户分销提现列表 */ public function shareCashSaasList() { $query = Cash::find()->alias('c') ->where(['c.is_delete' => Cash::IS_DELETE_NO, 'c.store_id' => $this->store_id]) ->leftJoin('{{%saas_user}} s', 's.id=c.saas_id') ->andWhere(['c.cash_type' => Cash::IS_CASH_TYPE_SHARE]); $query->distinct()->orderBy('c.status ASC,c.created_at DESC')->select([ 'c.*','s.name saas_name','s.avatar avatar_url','s.mobile telphone' ]); if ($this->keyword) { $query->andWhere([ 'or', ['like', 's.name', $this->keyword] ]); } if ($this->dateStart) { $query->andWhere(['>=', 'c.created_at', strtotime($this->dateStart)]); } if ($this->dateEnd) { $query->andWhere(['<=', 'c.created_at', strtotime($this->dateEnd)]); } if ($this->status == Cash::STATUS_APPLY and $this->status != '') {//待审核 $query->andWhere(['c.status' => Cash::STATUS_APPLY]); } if ($this->status == Cash::STATUS_CONFIRM) {//待打款 $query->andWhere(['c.status' => Cash::STATUS_CONFIRM]); } if ($this->status == Cash::STATUS_GIVEN) {//已打款 $query->andWhere(['in', 'c.status', [Cash::STATUS_GIVEN, Cash::STATUS_RECHARGE]]); } if ($this->status == Cash::STATUS_REFUSE) {//无效 $query->andWhere(['c.status' => Cash::STATUS_REFUSE]); } $pagination = pagination_make($query); $list = $pagination['list']; foreach($list as &$value){ $value['service_money'] = $value['service_charge'] * $value['price'] / 100; $value['created_at'] = date('Y-m-d H:i:s', $value['created_at']); $value['updated_at'] = !empty($value['updated_at']) ? date('Y-m-d H:i:s', $value['updated_at']) : ''; $value['money'] = Cash::getServiceMoney($value); //$sassuser = SaasUser::findOne(['mobile' => $value['binding']]); //$value['avatar_url'] = !empty($sassuser['avatar']) ? $sassuser['avatar'] : $value['avatar_url']; } return [ 'code' => 0, 'msg' => 'success', 'data' => [ 'export_list' => $this->getCustomField(), 'data' => $list, 'pageNo' => $pagination['pageNo'], 'totalCount' => $pagination['totalCount'] ], ]; } public function getCustomField() { return [ [ 'key' => 'order_no', 'value' => '订单号' ], [ 'key' => 'nickname', 'value' => '姓名', ], [ 'key' => 'price', 'value' => '提现金额', ], [ 'key' => 'addtime', 'value' => '申请日期', ], [ 'key' => 'bank_name', 'value' => '银行名称', ], [ 'key' => 'bank_card', 'value' => '打款账号', ], [ 'key' => 'name', 'value' => '真实姓名', ], [ 'key' => 'type', 'value' => '类型', ], [ 'key' => 'pay_type', 'value' => '打款方式', ], [ 'key' => 'pay_time', 'value' => '付款时间', ], ]; } public function getCashSetting() { $cash = Option::get(OptionSetting::CASH_SETTING, get_store_id(), 'store')['value']; if ($cash) { $data = json_decode($cash, true); } else { $data = [ 'pay_wechat' => 0, 'pay_alipay' => 0, 'bank' => 0, 'remaining_sum' => 0, 'lg' => 0, 'min_money' => 0, //最小提现额度 'cash_max_day' => 0, //每天最大提现额度 'cash_max_single_day' => 0, //每人每天提现额度 'cash_service_charge' => floatval(0), //提现手续费 'cash_price_type' => '', 'cash_price_amount' => floatval(0), 'cash_price_balance' => floatval(0), 'cash_price_integral' => floatval(0), 'auto_money' => 0 ]; } $data['auto_money'] = $data['auto_money'] ?? 0; return ['code' => 0, 'msg' => 'success', 'data' => $data]; } public function editCashSetting() { if (isset($this->cash_price_type)) { $total_profit = 0; $cash_price_type = explode(',', $this->cash_price_type); if (in_array(CashExt::CASH_PRICE_TYPE_AMOUNT, $cash_price_type)) { $total_profit = bcadd($total_profit, $this->cash_price_amount, 2); } if (in_array(CashExt::CASH_PRICE_TYPE_INTEGRAL, $cash_price_type)) { $total_profit = bcadd($total_profit, $this->cash_price_integral, 2); } if (in_array(CashExt::CASH_PRICE_TYPE_BALANCE, $cash_price_type)) { $total_profit = bcadd($total_profit, $this->cash_price_balance, 2); } if ($total_profit != 100) { return [ 'code' => 1, 'msg' => '佣金/积分/余额比例设置错误' ]; } } $data = [ 'pay_wechat' => $this->pay_wechat, 'pay_alipay' => $this->pay_alipay, 'bank' => $this->bank, 'remaining_sum' => $this->remaining_sum, 'lg' => $this->lg, 'min_money' => $this->min_money, //最小提现额度 'cash_max_day' => $this->cash_max_day, //每天最大提现额度 'cash_max_single_day' => $this->cash_max_single_day, //每人每天提现额度 'cash_service_charge' => floatval($this->cash_service_charge), //提现手续费 'cash_price_type' => $this->cash_price_type, 'cash_price_amount' => floatval($this->cash_price_amount), 'cash_price_balance' => floatval($this->cash_price_balance), 'cash_price_integral' => floatval($this->cash_price_integral), 'auto_money' => floatval($this->auto_money), ]; Option::set(OptionSetting::CASH_SETTING, json_encode($data), get_store_id(), 'store'); return ['code' => 0, 'msg' => 'success', 'data' => $data]; } public function getCashList() { $query = Cash::find()->alias('c') ->where(['c.is_delete' => Cash::IS_DELETE_NO, 'c.store_id' => $this->store_id]) ->leftJoin(['u' => User::tableName()], 'u.id=c.user_id'); if ($this->keyword) { $query->andWhere(['like', 'u.nickname', $this->keyword]); } if ($this->dateStart) { $query->andWhere(['>=', 'c.created_at', strtotime($this->dateStart)]); } if ($this->dateEnd) { $query->andWhere(['<=', 'c.created_at', strtotime($this->dateEnd)]); } if ($this->status == Cash::STATUS_APPLY and $this->status !== '') {//待审核 $query->andWhere(['c.status' => Cash::STATUS_APPLY]); } if ($this->status == Cash::STATUS_CONFIRM) {//待打款 $query->andWhere(['in', 'c.status', [Cash::STATUS_CONFIRM, Cash::STATUS_LG_CONFIRM]]); } if ($this->status == Cash::STATUS_GIVEN) {//已打款 $query->andWhere(['in', 'c.status', [Cash::STATUS_GIVEN, Cash::STATUS_HAND, Cash::STATUS_RECHARGE]]); } if ($this->status == Cash::STATUS_REFUSE) {//无效 $query->andWhere(['c.status' => Cash::STATUS_REFUSE]); } if ($this->id) { $query->andWhere(['s.id' => $this->id]); } if (isset($this->type) && $this->type > -1) { $query->andWhere(['c.type' => $this->type]); } if ($this->flag == Export::EXPORT) { $export = new ExportList(); $data = $query->orderBy('id DESC') ->select(['c.*', 'u.nickname', 'u.avatar_url','u.platform', 'u.id user_id'])->asArray()->all(); $export->shareExportData($data, $this->fields); } $query->distinct()->orderBy('id DESC')->select([ 'c.*', 'u.nickname','u.platform', 'u.avatar_url','u.binding' ]); $pagination = pagination_make($query); $list = $pagination['list']; foreach($list as &$value){ $value['wx_cash_status'] = intval($value['wx_cash_status']); $value['type_name'] = Cash::getTypeName($value); $value['status_name'] = Cash::getCashStatusName($value); $value['service_money'] = $value['service_charge'] * $value['price'] / 100; $value['created_at'] = date('Y-m-d H:i:s', $value['created_at']); $value['updated_at'] = !empty($value['updated_at']) ? date('Y-m-d H:i:s', $value['updated_at']) : ''; $value['money'] = Cash::getServiceMoney($value); $saas_user = SaasUser::findOne(['mobile' => $value['binding']]); $value['avatar_url'] = !empty($saas_user['avatar']) ? $saas_user['avatar'] : $value['avatar_url']; $value['card_no'] = ''; if ($saas_user->withdraw_method) { $withdraw_method = json_decode($saas_user->withdraw_method, true); if (!empty($withdraw_method)) { foreach ($withdraw_method as $method_item) { if (intval($value['type']) === Cash::TYPE_ALIPAY && $method_item['type'] === 'alipay') { $value['cash_img'] = $method_item['cash_img']; } else if (intval($value['type']) === Cash::TYPE_WX && $method_item['type'] === 'wechat'){ $value['cash_img'] = $method_item['cash_img']; } else if (intval($value['type']) === Cash::TYPE_BANK && $method_item['type'] === 'bank_card') { $value['card_no'] = $method_item['card_no']; } } } } $value['real_price'] = $value['money'];; $cashExtArr = CashExt::find()->where(['cash_id' => $value['id']])->select('cash_price_type, real_price')->asArray()->all(); $value['cash_ext_text'] = null; if ($cashExtArr) { $value['cash_ext_text'] = '提现明细:'; foreach ($cashExtArr as $cashExtItem) { if ($cashExtItem['cash_price_type'] == CashExt::CASH_PRICE_TYPE_AMOUNT) { $value['real_price'] = $cashExtItem['real_price']; } $value['cash_ext_text'] .= CashExt::$cashPriceTypeMap[$cashExtItem['cash_price_type']] . ':' . $cashExtItem['real_price'] . ';'; } } $value['integral_appreciation_num'] = 0; $value['integral_appreciation_price'] = 0; } if($this->export){ return $this->export($list); } return [ 'code' => 0, 'msg' => 'success', 'data' => [ 'q' => $query->createCommand()->getRawSql(), 'export_list' => $this->getCustomField(), 'data' => $list, 'pageNo' => $pagination['pageNo'], 'totalCount' => $pagination['totalCount'] ], ]; } }