Esempio n. 1
0
 public function actionOrder()
 {
     $student_id = Yii::$app->request->post('student_id');
     //用户id
     $payPWD = Yii::$app->request->post('payPWD');
     //用户支付密码
     $model = new Merchant();
     $user = $model->sel_student($student_id);
     //print_r($user['student_pay_pwd']);die;
     if ($payPWD != $user['student_pay_pwd']) {
         echo 1;
         //支付密码错误
     } else {
         echo 2;
         //支付密码正确
     }
 }
Esempio n. 2
0
 public function business_register($data)
 {
     $model = new BusinessRegister();
     /*$model->attributes = $data;
     		//进行validate验证
     		if (!$model->validate()) {//验证不通过
     			$errors = $model->errors;
     			print_R($errors);die;
     		}*/
     $model->user_phone = $data['user_phone'];
     $model->user_password = md5($data['user_password']);
     $model->addtime = time();
     $model->user_type = '2';
     if ($model->save(false)) {
         $type = $data['merchant_type'];
         if (count($type) == '1') {
             $merchant_type = $type[0];
         } else {
             $merchant_type = '3';
         }
         $id = \Yii::$app->db->getLastInsertID();
         $mer = new Merchant();
         $mer->user_id = $id;
         $mer->merchant_name = $data['merchant_name'];
         $mer->merchant_type = $merchant_type;
         if ($mer->save(false)) {
             $session = Yii::$app->session;
             $session->set('user_id', $id);
             return '1';
             //成功
         } else {
             return '2';
         }
     } else {
         return '2';
     }
 }
Esempio n. 3
0
 public function addDiscount($data)
 {
     $user_id = $data['user_id'];
     //查询merchant_id
     $merchant = Merchant::find()->where(['user_id' => $user_id])->one();
     $merchant_id = $merchant['merchant_id'];
     $this->merchant_id = $merchant_id;
     $this->start_time = microtime($data['start_time']);
     $this->end_time = microtime($data['end_time']);
     $this->discount_type = $data['discount_type'];
     if ($data['discount_type'] == '1') {
         $this->discount_explain = "满一百减" . $data['discount_explain'];
     } else {
         $this->discount_explain = $data['discount_explain'] / 10;
     }
     $this->addtime = time();
     $this->discount_status = 1;
     return $this->save(false);
 }
Esempio n. 4
0
 public function updateMerchant($data)
 {
     $user_id = $data['user_id'];
     $merchantInfo = $data['Merchant'];
     $merchant = Merchant::find()->where(['user_id' => $user_id])->one();
     $merchant->merchant_name = $merchantInfo['merchant_name'];
     $merchant->merchant_linkman = $merchantInfo['merchant_linkman'];
     $merchant->merchant_tel = $merchantInfo['merchant_tel'];
     $merchant->merchant_position = $merchantInfo['merchant_position'];
     $merchant->merchant_province = $merchantInfo['merchant_province'];
     $merchant->merchant_city = $merchantInfo['merchant_city'];
     $merchant->merchant_district = $merchantInfo['merchant_district'];
     $merchant->merchant_address = $merchantInfo['merchant_address'];
     $merchant->merchant_categoryparent = $merchantInfo['merchant_categoryparent'];
     $merchant->merchant_categorychild = $merchantInfo['merchant_categorychild'];
     $merchant->merchant_desc = $merchantInfo['merchant_desc'];
     $merchant->addtime = time();
     $merchant->merchant_sort = 50;
     $merchant->merchant_status = 1;
     return $merchant->save(false);
 }
 public function actionUpdateImage()
 {
     $data = yii::$app->request->post();
     $upload = new UploadFile();
     $uploadInfo = $upload->upload();
     if ($data['type_table'] == 'aptitude') {
         //实例化资质表 入库
         $aptitude = new Aptitude();
         $data['aptitude_img'] = $uploadInfo[0]['savename'];
         $aptitude->updateAptitude($data);
     } elseif ($data['type_table'] == 'merchant') {
         $merchant = new Merchant();
         $data['aptitude_img'] = $uploadInfo[0]['savename'];
         $merchant->merchantInsert($data);
     } elseif ($data['type_table'] == 'garllery') {
         //实例化商家相册表 入库
         $garllery = new MerchantGarllery();
         $data['aptitude_img'] = $uploadInfo[0]['savename'];
         $garllery->updateGarllery($data);
     }
     $arr = array('pic' => $uploadInfo[0]['savename']);
     echo json_encode($arr);
     die;
 }