| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace hd\controllers;
- use bizHd\ll\classes\LlEventClass;
- use common\components\util;
- use Yii;
- class LlEventController extends BaseController
- {
- public $guestAccess = [];
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $requestType = $get['requestType'] ?? '';
- if ($requestType == 'my') {
- $shopId = $this->shopId;
- $where = ['launchShopId' => $shopId];
- } else {
- $where = [];
- }
- $respond = LlEventClass::getEventList($where);
- util::success($respond);
- }
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $name = $post['name']??'';
- if(empty($name)){
- util::fail('请填写店名或姓名');
- }
- $no = $post['no']??'';
- if(!empty($no)){
- $pattern = '/^(?:\d{15}|\d{17}[\dxX])$/';
- $valid = preg_match($pattern, $no);
- if($valid == false){
- util::fail('身份证号错误');
- }
- }
- $mobile = $post['mobile']??'';
- $wx = $post['wx']??'';
- if(empty($wx) && empty($mobile) && empty($no)){
- util::fail('手机号、微信号、身份证必填一项');
- }
- $prove = $post['prove']??[];
- if(empty($prove)){
- util::fail('证据最少要一张');
- }
- $respond = LlEventClass::addEvent($post);
- util::success($respond);
- }
- }
|