$userId])->field('id,nickname,code')->find(); $mpParam['scene'] = 'invite_code='.$user['code']; $mpParam['page'] = $params['page'] ?? ''; if(empty($mpParam['page'])){ $mpParam['page'] = substr(ShopPageEnum::HOME_PAGE['mobile'],1); } if($id){ $mpParam['scene'] .= '&id='.$id; } $res = WeChatService::makeMpQrCode($mpParam,'base64'); return $res; } /** * @notes 分享砍价小程序码 * @param int $userId * @param array $params * @return bool|mixed|string * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author Tab * @date 2021/9/28 17:28 */ public function getMnpQrCodeInitiate(int $userId,array $params) { $param['page'] = substr(ShopPageEnum::HOME_PAGE['mobile'],1); $param['scene'] = 'initiate_id='.$params['initiate_id']; $param['page'] = substr(ShopPageEnum::INITIATE['mobile'],1); $res = WeChatService::makeMpQrCode($param,'base64'); return $res; } /** * @notes 获取今日头条小程序码 * @param int $userId * @param array $params * @return bool * @throws \Exception * @author cjhao * @date 2021/11/25 9:59 */ public function getTouTiaoQrcode(int $userId,array $params){ try{ $id = $params['id'] ?? ''; $user = User::where(['id'=>$userId])->field('id,nickname,code')->find(); $mpParam['appname'] = $params['appname']; $mpParam['page'] = $params['page'] .'?'.'invite_code='.$user['code'].'&id='.$id; if($id){ $mpParam['page'] .= '&id='.$id; } $toutiaoService = (new ToutiaoPayService()); $res = $toutiaoService->getQrcode($mpParam); self::$returnData = $res; return true; }catch (Exception $e){ self::$returnData = $e->getMessage(); return false; } } }