request->param('group'); if($group == 'system.ai' || $group=='system.pay' || $group=='plugin.ali_oss' || $group=='plugin.qiniu_kodo'){ return $this->success('返回成功', []); } $platform = $this->request->header('platform','wxMiniProgram'); $return = ConfServiceFacade::groupGet($group, true); if($platform == 'wxOfficialAccount'){ $systemWechat = ConfServiceFacade::groupGet('system.wechat', true); // print_r($systemWechat); if(!empty($systemWechat['appid'])){ $wechatAppid = $systemWechat['appid']; $return['wechat_appid'] = $wechatAppid; } } // $info = \app\model\Sk::orderRaw("rand() , id desc")->where(['uniacid'=>$_GPC['uniacid'],'status'=>1])->limit(1)->select()->toArray(); // if(!empty($info)){ // $return['sk'] = $this->encrypt($info[0]['sk'],'hello_wike'); // } return $this->success('获取成功', $return); } /*@formatter:off*/ /** * @ApiTitle (无需登录的接口) * @ApiSummary (无需登录的接口详细描述) * @ApiMethod (POST) * @ApiRoute (/api.demo/test1) * @ApiReturnParams (name="code", type="integer", description="接口返回码.0=常规正确码,表示常规操作成功;1=常规错误码,客户端仅需提示msg;其他返回码与具体业务相关。框架实现了的唯一其他返回码:10401,前端需要跳转至登录界面。在一个复杂的交互过程中,你可能需要自行定义其他返回码") * @ApiReturnParams (name="msg", type="string", description="返回描述") * @ApiReturnParams (name="time", type="integer", description="请求时间,Unix时间戳,单位秒") * @ApiReturnParams (name="data", type="object", description="返回的数据对象") * @ApiReturnParams (name="data.action", type="string", description="固定返回test1") * @ApiReturn ({ "code": 0, "msg": "返回成功", "time": 1591168410, "data": { "action": "test1" } }) */ /*@formatter:on*/ public function test1() { return $this->success('返回成功', ['action' => 'test1']); } /*@formatter:off*/ /** * @ApiTitle (参数传递array的接口) * @ApiSummary (参数传递array的接口详细描述) * @ApiMethod (POST) * @ApiRoute (/api.demo/arrayParam) * @ApiParams (name="id", type="string", required="true", description="ID") * @ApiParams (name="name", type="array", required="true", description="数组中的值") * @ApiParams (name="array[key]", type="array", required="true", description="数组中的值") * @ApiReturnParams (name="code", type="integer", description="接口返回码.0=常规正确码,表示常规操作成功;1=常规错误码,客户端仅需提示msg;其他返回码与具体业务相关。框架实现了的唯一其他返回码:10401,前端需要跳转至登录界面。在一个复杂的交互过程中,你可能需要自行定义其他返回码") * @ApiReturnParams (name="msg", type="string", description="返回描述") * @ApiReturnParams (name="time", type="integer", description="请求时间,Unix时间戳,单位秒") * @ApiReturnParams (name="data", type="object", description="返回的数据对象") * @ApiReturnParams (name="data.action", type="string", description="固定返回test1") * @ApiReturn ({ "code": 0, "msg": "返回成功", "time": 1591168410, "data": { "action": "test1" } }) */ /*@formatter:on*/ public function arrayParam() { return $this->success('返回成功', $this->request->param('i')); } public function encrypt($str, $key){ $mixStr = md5(date('Y-m-d H:i:s').rand(1000,10000)); $tmp = ''; $strLen = strlen($str); for($i=0, $j=0; $i<$strLen; $i++, $j++){ $j = $j == 32 ? 0 : $j; $tmp .= $mixStr[$j].($str[$i] ^ $mixStr[$j]); } return base64_encode($this->bind_key($tmp, $key)); } public function decrypt($str, $key){ $str = $this->bind_key(base64_decode($str), $key); $strLen = strlen($str); $tmp = ''; for($i=0; $i<$strLen; $i++){ $tmp .= $str[$i] ^ $str[++$i]; } return $tmp; } public function bind_key($str, $key){ $encrypt_key = md5($key); $tmp = ''; $strLen = strlen($str); for($i=0, $j=0; $i<$strLen; $i++, $j++){ $j = $j == 32 ? 0 : $j; $tmp .= $str[$i] ^ $encrypt_key[$j]; } return $tmp; } }