isAjax()) { $page = input('page', 1); $pay = new PayShop(); $condition = [ ['a.ag_site_id', '=', $this->site_id], ['a.is_zmpay', '=', 1], ]; $search_text = input('search_text', ''); if ($search_text) { $condition[] = ['a.merchant_name|a.contacts_name|a.contacts_phone', 'like', '%' . $search_text . '%']; } $res = $pay->getPageList($condition, $page); return $res; } $this->forthMenu(); return $this->fetch('alipay/list'); } /*** * 添加芝麻商户 * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function add() { $payShop = new PayShop(); $shop_id = input('shop_id', 0); if (request()->isAjax()) { $data = request()->post(); $settleAccountList = []; if (isset($data['settleAccountList'])) { $user = Db::name('website') ->where('id', 'in', $data['settleAccountList']) ->column('id,alipay_account,web_contacts,web_phone,role_ids', 'id'); $web_ids = $data['settleAccountList']; foreach ($user as $key => $item) { $role_ids = explode(',', $item['role_ids']); $rate = Db::name('agent_level')->where('level_id', 'in', $role_ids)->value('sum(rate)'); if ($rate && $item['alipay_account']) { $settleAccountList[$key]['settleAccount'] = $item['alipay_account']; $settleAccountList[$key]['separateLedgerRate'] = $rate; $settleAccountList[$key]['payeeRealName'] = $item['web_contacts']; } } $data['website_ids'] = $web_ids; unset($data['settleAccountList']); } $pay = new CloudPay(); $res = $pay->upAlipayUser($data, $settleAccountList); $updata = [ 'zmalipay_value' => $data ]; if ($res['code'] == '10000') { $updata['is_zmpay'] = 1; } $Info = $payShop->where('shop_id', $shop_id)->save($updata); return $res; } if ($shop_id) { $where = [ 'a.shop_id' => $shop_id, 'u.app_type' => 'aliapp', ]; $regInfo = $payShop ->where($where) ->alias('a') ->field('a.*,u.appid') ->join('uni_account u', 'a.site_id=u.site_id', 'left') ->find(); if(empty($regInfo)){ $this->error('请绑定小程序'); } $agentUser = Db::name('website')->where('website_pid', '=', $this->site_id)->field('id,alipay_account,web_contacts,web_phone')->select(); $payInfo = $regInfo['alipay_value']; $zmalipay_value = $regInfo['zmalipay_value']; $this->assign('zmalipay', $zmalipay_value); $this->assign('shop_id', $shop_id); $this->assign('info', $regInfo); $this->assign('payInfo', $payInfo); $this->assign('userList', $agentUser); } else { $this->error('直通商户无效'); } return $this->fetch('alipay/add_user'); } public function edit() { if (request()->isAjax()) { } return $this->fetch('alipay/edit_user'); } public function getalicategory() { $AlipayCategory = new AlipayCategory(); $name = input('name'); $res = $AlipayCategory->getCategory($name); return $res; } }