getCategory($name); return $res; } /*** * 添加芝麻商户 * @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(); $data['separateLedgerRate'] = $this->AgentInfo['platform_offlinecommission_rate'] ?: config('accounts.aliapp.fee_commission');//平台佣金 $settleAccountList = [ //渠道佣金 [ 'settleAccount' => $this->AgentInfo['alipay_account'], 'separateLedgerRate' => $data['channel_commission_rate'], 'payeeRealName' => $this->AgentInfo['alipay_account_name'], ] ]; $pay = new CloudPay(); if ($data['app_logo']) { $driver = config('upload')['driver'] ?? 'gd'; $image_service = new ImageService($driver); //图片处理 if (strpos($data['app_logo'], 'aliyuncs') == false) { $image = $image_service->open(img($data['app_logo']))->thumb(160, 160); $file = root_path() . 'runtime/temp/' . md5($data['app_logo']) . $this->mime[$image->image->mime]; $image->save($file, 100); $img = UrlimgBase64($file); $logo = $pay->logoUpload($img); if ($logo['code'] == '10000') { $data['logoUrl'] = $logo['pictureUrl']; } else { return error(-1, '请保证尺寸160*160像素尺寸不得大于2M'); } } else { $data['logoUrl'] = $data['app_logo']; } } else if (!isset($data['logoUrl'])) { return error(-1, '请保证尺寸160*160像素尺寸不得大于2M'); } if ($data['channel_commission_rate'] == 0) { $settleAccountList = []; } $res = $pay->upAlipayUser($data, $settleAccountList); $updata = [ 'zmalipay_value' => $data, 'service_commission' => $data['channel_commission_rate'], 'settleAccountList' => json_encode($settleAccountList), ]; $res['message'] = $res['sub_msg'] ?? $res['msg']; $payShop->where('shop_id', $shop_id)->save($updata); return $res; } if ($shop_id) { $where = [ 'shop_id' => $shop_id ]; $regInfo = $payShop ->where($where) ->json(['settleAccountList', 'alipay_value', 'zmalipay_value'], true) ->find()->toArray(); if (empty($regInfo)) return $this->error('位置错误'); $config_model = new \addon\aliapp\model\Config(); $config_info = $config_model->getAppConfig($regInfo['site_id'])['data']['value']; $payInfo = $regInfo['alipay_value']; $zmalipay_value = $regInfo['zmalipay_value']; if ($zmalipay_value && isset($zmalipay_value['logoUrl'])) { $config_info['head_img'] = $zmalipay_value['logoUrl']; } $this->assign('zmalipay', $zmalipay_value); $this->assign('shop_id', $shop_id); $this->assign('info', $regInfo); $this->assign('minapp', $config_info); $this->assign('payInfo', $payInfo); } else { $this->error('直通商户无效'); } return $this->fetch('pay/zmaccount'); } }