Esempio n. 1
0
 public function get_rouji_info()
 {
     $mobile = $this->input->cookie('mobileNum');
     $token = $this->input->cookie('token');
     $rt = $this->model->mobileExist($mobile);
     if (!$rt) {
         jsonout(2004, '手机号码不存在,非法用户访问');
     }
     $rt = $this->model->tokenCK($mobile, $token);
     if (!$rt) {
         jsonout(2005, 'token 无效');
     }
     $data = $this->model->getRoujiInfo($mobile);
     jsonout(0, '获取信息成功', $data);
 }
Esempio n. 2
0
 function josnpost()
 {
     $json = file_get_contents("php://input");
     if (empty($json)) {
         //$json = file_get_contents("php://stdin");
         return array();
     }
     $array = json_decode($json, true);
     log_message("INFO", 'json in put:' . $json);
     log_message("INFO", 'cookie in put:' . json_encode($_COOKIE));
     if ($array === false) {
         jsonout(1000, '提交数据格式错误');
     }
     return $array;
 }
Esempio n. 3
0
 public function generateXml()
 {
     $products = $this->model->products()->where('active=', 1)->joined(true)->and_where("product_instock=", 1)->get();
     foreach ($products as $key => $item) {
         $products[$key]['priceUAH'] = ceil($item['price'] * $this->course);
     }
     $catalog = $this->model->catalog()->where('active=', 1)->order("tree_path ASC")->get();
     $hotline = $this->getHotlineTemplate($products, $catalog);
     $metamarket = $this->getMetamarketTemplate($products, $catalog);
     $nadavi = $this->getNadaviTemplate($products, $catalog);
     $priceua = $this->getPriceuaTemplate($products, $catalog);
     $yml = $this->getYmlTemplate($products, $catalog);
     if ($hotline && $metamarket && $nadavi && $priceua && $yml) {
         jsonout(array("ok" => 1));
     } else {
         jsonout(array("error" => 1));
     }
     //printr($hotline);
 }
Esempio n. 4
0
 function get_note_by_rouji()
 {
     $mobile = $this->input->cookie('mobileNum');
     $token = $this->input->cookie('token');
     $rt = $this->model->mobileExist($mobile);
     if (!$rt) {
         jsonout(2004, '手机号码不存在,非法用户访问');
     }
     $rt = $this->model->tokenCK($mobile, $token);
     if (!$rt) {
         jsonout(2005, 'token 无效');
     }
     if (empty($this->json['issueId'])) {
         jsonout(2015, '参数issueId缺失');
     }
     if (empty($this->json['customerMobileNum'])) {
         jsonout(2015, '参数customerMobileNum缺失');
     }
     $rt = $this->model->issueidExist($this->json['issueId']);
     if (!$rt) {
         jsonout(2015, '非法issueId');
     }
     $data = $this->model->getNoteByRouji($mobile, $this->json['issueId'], $this->json['customerMobileNum']);
     if ($data == false) {
         jsonout(1120, '获取笔记详细失败,其它原因');
     }
     jsonout(0, '获取成功', $data);
 }
Esempio n. 5
0
 public function get_customer_list()
 {
     $mobile = $this->input->cookie('mobileNum');
     $token = $this->input->cookie('token');
     $rt = $this->model->mobileExist($mobile);
     if (!$rt) {
         jsonout(2004, '手机号码不存在');
     }
     $rt = $this->model->tokenCK($mobile, $token);
     if (!$rt) {
         jsonout(2005, 'token 无效');
     }
     if (empty($this->json['pageIndex'])) {
         jsonout(2015, '参数pageIndex缺失');
     }
     if (empty($this->json['pageSize'])) {
         jsonout(2015, '参数pageSize 不正确');
     }
     if (empty($this->json['sort'])) {
         jsonout(2015, '参数sort缺失');
     }
     if ($this->json['sort'] != '01' && $this->json['sort'] != '02') {
         jsonout(2015, '参数sort不正确');
     }
     $data = $this->model->getCustomerList($mobile, $this->json['pageIndex'], $this->json['pageSize'], $this->json['sort']);
     jsonout(0, '获取成功', $data);
 }
Esempio n. 6
0
 public function addItem()
 {
     if ($this->request->post("id")) {
         $id = (int) $this->request->post("id");
         $this->addToCart($id);
         $data = $this->checkBasket();
         $countWord = $this->module->getNumEnding($data['count'], array("товар", "товара", "товаров"));
         if ($data) {
             jsonout(array("ok" => 1, "price" => $data['price'], "count" => $data['count'], "countWord" => $countWord));
         }
     }
 }
Esempio n. 7
0
 public function import_xml($xml = null)
 {
     ini_set('memory_limit', '1024M');
     if ($this->modules->users->is("dev_mode")) {
     } else {
         jsonout(array("error" => "У вас недостаточно прав для доступа к импорту"));
     }
 }
Esempio n. 8
0
 public function addComment()
 {
     if ($this->request->post("name") && $this->request->post("body") && $this->request->post("mark") && $this->request->post("id")) {
         $name = strip_tags(trim($this->request->post("name")));
         $body = strip_tags(trim($this->request->post("body")));
         $mark = (int) $this->request->post("mark");
         $product_id = (int) $this->request->post("id");
         $insert = $this->database->insert("coments", array("idate" => time(), "name_rus" => $name, "body_rus" => $body, "mark" => $mark, "product_id" => $product_id, "active" => -1));
         if ($insert) {
             jsonout(array("ok" => 1));
         }
     }
 }