예제 #1
0
 public function ShowModel($model)
 {
     $this->LogInfo("show");
     $objID = $this->GetObj();
     $condition[$model->getPk()] = $objID;
     try {
         $object = MispCommonService::GetUniRecord($model, $condition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     $data['obj'] = $object;
     $this->ReturnJson($data);
 }
 public function GetLatestVersion()
 {
     $this->LogInfo("Get latest client version.");
     $req = $this->GetReqObj();
     $condition['client_type'] = $req->clientType;
     $condition['company_id'] = $req->app_id;
     $condition['version_status'] = VersionStatusEnum::LATEST_VERSION;
     $ClientVersionDao = $this->GetModel();
     try {
         $object = MispCommonService::GetUniRecord($ClientVersionDao, $condition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     $this->LogInfo("Latest client version info " . json_encode($object));
     $data['obj'] = $object;
     $this->ReturnJson($data);
 }
 public function Show()
 {
     $reqType = $this->GetReqType();
     if ($reqType == ClientTypeEnum::IOS || $reqType == ClientTypeEnum::ANDROID) {
         //验证APP是否登录
         $this->DoAuth();
     }
     $objID = $this->GetCommonData();
     $this->LogInfo("show customer, user_id is " . $objID);
     $viewCustomerDao = LaundryDaoContext::ViewCustomer();
     $condition['user_id'] = $objID;
     try {
         $object = MispCommonService::GetUniRecord($viewCustomerDao, $condition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     $data['obj'] = $object;
     $this->ReturnJson($data);
 }
예제 #4
0
 public function Create()
 {
     $this->LogInfo("APP create order...");
     //验证APP是否登录
     $this->DoAuth();
     $req = $this->GetReqObj();
     //创建订单
     $order = $req->order;
     $orderData = $this->objectToArray($order);
     $orderDao = $this->GetModel();
     do {
         $orderData['order_code'] = date('ymdHis', time()) . rand(1000, 9999);
     } while ($orderDao->where('order_code=' . $orderData['order_code'])->count());
     if (OrderEnum::OnlinePay == $orderData['pay_option']) {
         $orderData['order_status'] = OrderEnum::WaitBuyerPay;
     } else {
         $orderData['order_status'] = OrderEnum::OrderSubmit;
     }
     $orderData['create_time'] = date('Y-m-d H:i:s', time());
     $orderData['company_id'] = $req->app_id;
     $this->LogInfo("order info is " . json_encode($orderData));
     try {
         $result = MispCommonService::Create($orderDao, $orderData);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     //正常下单创建订单详情
     if ($orderData['order_type'] == OrderEnum::NormalOrder) {
         //创建订单详情
         $orderDetailDao = LaundryDaoContext::OrderDetail();
         $orderDetailList = $req->orderDetailList;
         for ($i = 0; $i < count($orderDetailList); $i++) {
             $orderDetailList[$i] = $this->objectToArray($orderDetailList[$i]);
             $orderDetailList[$i]['order_id'] = $result;
         }
         $this->LogInfo("order type is " . OrderEnum::NormalOrder);
         $this->LogInfo("order detail is " . json_encode($orderDetailList));
         try {
             $detailResult = MispCommonService::CreateList($orderDetailDao, $orderDetailList);
         } catch (FuegoException $e) {
             $this->errorCode = $e->getCode();
             $this->ReturnJson();
             return;
         }
     }
     //直接下单
     if (OrderEnum::DirectOrder == $orderData['order_type']) {
         $this->LogInfo("order type is " . OrderEnum::DirectOrder);
     }
     //发出订单邮件通知
     $adminDao = LaundryDaoContext::administrators();
     $CompanyCondition['company_id'] = $req->app_id;
     $Email = $adminDao->where($CompanyCondition)->getField('email');
     $this->LogInfo("admin email is " . $Email);
     if (false == SendMail($Email, OrderEnum::EMAIL_TITLE, "会员:" . $orderData['user_name'] . " 已成功提交订单,订单号为:" . $orderData['order_code'] . "。请及时处理!")) {
         $this->LogErr("Order has create,But send mail failed.");
     }
     //获取订单信息返回
     $orderCondition['order_code'] = $orderData['order_code'];
     try {
         $object = MispCommonService::GetUniRecord($orderDao, $orderCondition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     $data['obj'] = $object;
     $this->ReturnJson($data);
 }
예제 #5
0
 public function Show()
 {
     $objID = $this->GetCommonData();
     $this->LogInfo("show admin, user_id is " . $objID);
     $viewAdminDao = LaundryDaoContext::ViewAdmin();
     $condition['user_id'] = $objID;
     try {
         $object = MispCommonService::GetUniRecord($viewAdminDao, $condition);
     } catch (FuegoException $e) {
         $this->errorCode = $e->getCode();
         $this->ReturnJson();
         return;
     }
     $data['obj'] = $object;
     $this->ReturnJson($data);
 }