checkToken(); if ($token[ 'code' ] < 0) return $this->response($token); $arr=[ [ 'name' => 'RADIO', 'title' => '单选框', 'type' => 'SYSTEM', 'controller' => 'Radio', 'value' => array ( 'title' => '执照类型', 'options' => array ( 0 => '企业统一社会信用代码', 1 => '个体统一社会信用代码', 2 => '个体营业执照注册号', ), 'required' => true, ), 'sort' => '10000', 'support_diy_view' => '', 'max_count' => 0, 'is_delete' => 0, 'icon' => 'addon/form/shop/view/public/img/icon/radio.png', 'icon_selected' => 'addon/form/shop/view/public/img/icon/radio_selected.png', 'id' => 'codeType' ] , [ 'name' => 'ONE_LINE_TEXT', 'title' => '单行文本', 'type' => 'SYSTEM', 'controller' => 'Text', 'value' => array ( 'title' => '企业名称', 'placeholder' => '请输入企业名称', 'default' => '', 'required' => true, ), 'sort' => '10000', 'support_diy_view' => '', 'max_count' => 0, 'is_delete' => 0, 'icon' => 'addon/form/shop/view/public/img/icon/on_line_text.png', 'icon_selected' => 'addon/form/shop/view/public/img/icon/on_line_text_selected.png', 'id' => 'corporate_name', ], [ 'name' => 'RADIO', 'title' => '单选框', 'type' => 'SYSTEM', 'controller' => 'Radio', 'value' => array ( 'title' => '小程序注册', 'options' => array ( 0 => '未注册小程序', 1 => '已有认证小程序', ), 'required' => true, ), 'sort' => '10000', 'support_diy_view' => '', 'max_count' => 0, 'is_delete' => 0, 'icon' => 'addon/form/shop/view/public/img/icon/radio.png', 'icon_selected' => 'addon/form/shop/view/public/img/icon/radio_selected.png', 'id' => 'is_reg', ], [ 'name' => 'ONE_LINE_TEXT', 'title' => '单行文本', 'type' => 'SYSTEM', 'controller' => 'Text', 'value' => array ( 'title' => '执照编码', 'placeholder' => '统一社会信用代码或执照编码', 'default' => '', 'required' => true, ), 'sort' => '10000', 'support_diy_view' => '', 'max_count' => 0, 'is_delete' => 0, 'icon' => 'addon/form/shop/view/public/img/icon/on_line_text.png', 'icon_selected' => 'addon/form/shop/view/public/img/icon/on_line_text_selected.png', 'id' => 'cert_no', ], [ 'name' => 'ONE_LINE_TEXT', 'title' => '单行文本', 'type' => 'SYSTEM', 'controller' => 'Text', 'value' => array ( 'title' => '法人姓名', 'placeholder' => '请输入法人姓名', 'default' => '', 'required' => true, ), 'sort' => '10000', 'support_diy_view' => '', 'max_count' => 0, 'is_delete' => 0, 'icon' => 'addon/form/shop/view/public/img/icon/on_line_text.png', 'icon_selected' => 'addon/form/shop/view/public/img/icon/on_line_text_selected.png', 'id' => 'legal_persona_name', ], [ 'name' => 'ONE_LINE_TEXT', 'title' => '单行文本', 'type' => 'SYSTEM', 'controller' => 'Text', 'value' => array ( 'title' => '法人微信号', 'placeholder' => '填写法人微信号;请勿输入手机号', 'default' => '', 'required' => true, ), 'sort' => '10000', 'support_diy_view' => '', 'max_count' => 0, 'is_delete' => 0, 'icon' => 'addon/form/shop/view/public/img/icon/on_line_text.png', 'icon_selected' => 'addon/form/shop/view/public/img/icon/on_line_text_selected.png', 'id' => 'legal_persona_wechat', ], [ 'name' => 'MOBILE', 'title' => '手机号码', 'type' => 'SYSTEM', 'controller' => 'Text', 'value' => array ( 'title' => '手机号码', 'placeholder' => '请输入联系电话', 'required' => true, ), 'sort' => '10000', 'support_diy_view' => '', 'max_count' => 0, 'is_delete' => 0, 'icon' => 'addon/form/shop/view/public/img/icon/mobile.png', 'icon_selected' => 'addon/form/shop/view/public/img/icon/mobile_selected.png', 'id' => 'contact_phone', ], [ 'name' => 'IMG', 'title' => '图片', 'type' => 'SYSTEM', 'controller' => 'Img', 'value' =>[ 'title' => '营业执照', 'max_count' => '1', 'required' => true ], 'sort' => '10000', 'support_diy_view' => '', 'max_count' => 0, 'is_delete' => 0, 'icon' => 'addon/form/shop/view/public/img/icon/img.png', 'icon_selected' => 'addon/form/shop/view/public/img/icon/img_selected.png', 'id' => 'license_pic', ] ]; $Applet = new AppletReg(); $info=$Applet->where('member_id', '=', $this->member_id) ->where('status', '<>', 'AGREED') ->find(); if($info&&isset($info['value']['formData'])){ $arr=$info['value']['formData']; } $condition[] = [ 'site_id', '=', 1]; $condition[] = [ 'id', '=', 74 ]; $diy_view = new DiyViewModel(); $info = $diy_view->getSiteDiyViewDetail($condition); $res=[ 'json_data'=>$arr, 'banner_img'=>'public/resource/form/cbanner.jpg', 'isNextStep'=>1, 'diyData'=>$info['data'], ]; return $this->response($this->success($res)); } /*** * 创建小程序 * @return false|string */ public function create() { $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); $Applet = new AppletReg(); $data = request()->post(); $formData = json_decode($data['form_data'], true); $codeTypeText = [ '企业统一社会信用代码' => 'enterprise', '个体统一社会信用代码' => 'individual', '个体营业执照注册号' => 'individual_code', ]; $form_data = array_column($formData, 'val', 'id'); $form_data['ag_site_id'] = $this->site_id; $form_data['member_id'] = $this->member_id; $form_data['corporate_type'] = $codeTypeText[$form_data['codeType']]; $form_data['formData'] = $formData; $form_data['contact_name'] = $form_data['legal_persona_name']; $regText = [ '未注册小程序' => 0, '已有认证小程序' => 1 ]; $form_data['id'] = $Applet-> where('member_id', '=', $this->member_id) ->where('status', '<>', 'AGREED') ->value('id'); $business_code = date('YmdHis') . rand(100, 999); $is_reg = $regText[$form_data['is_reg']]; $res = $Applet->RegWeapp('we' . $business_code, $form_data, $is_reg); $res['jump_url']=''; return $this->response($res); } }