Example #1
0
 public function bulk_update_type()
 {
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('ids', 'trim|required');
     $this->form_validation->set_rules('type', 'trim|required');
     $this->formCheck();
     // Receiving parameter
     $attribute_ids = t_Post('ids');
     $attribute_type = t_Post('type');
     // Business logic
     $attribute_ids = explode(',', $attribute_ids);
     if (!is_array($attribute_ids)) {
         resDie("Cannot delete referral data");
     }
     $this->mLoadModel('attribute_model');
     try {
         $this->attribute_model->batch_update_type($attribute_ids, $attribute_type);
     } catch (Exception $e) {
         resDie($e->getMessage());
     }
     // Response
     resOk();
 }
Example #2
0
 public function update_status()
 {
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('id', 'trim|required');
     $this->form_validation->set_rules('status', 'trim|required');
     $this->formCheck();
     // Receiving parameter
     $customer_id = t_Post('id');
     $customer_status = t_Post('status');
     // Business logic
     $status_active = 1;
     $status_blocked = 2;
     $dbData = array();
     $dbData['status'] = $customer_status == $status_active ? $status_blocked : $status_active;
     $dbData['update_time'] = time();
     $this->mLoadModel('customer_model');
     try {
         $this->customer_model->update($dbData, $customer_id);
     } catch (Exception $e) {
         resDie($e->getMessage());
     }
     // Response
     resOk();
 }
Example #3
0
 public function bulk_hide()
 {
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('ids', 'trim|required');
     $this->formCheck();
     // Receiving parameter
     $referral_ids = t_Post('ids');
     // Business logic
     $referral_ids = explode(',', $referral_ids);
     if (!is_array($referral_ids)) {
         resDie("Cannot delete referral data");
     }
     $this->mLoadModel('referral_model');
     try {
         $this->referral_model->batch_update($referral_ids, self::STATUS_BLOCK);
     } catch (Exception $e) {
         resDie($e->getMessage());
     }
     // Response
     resOk();
 }
Example #4
0
 public function delete($product_id_array = array())
 {
     // authentication none
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('promotion_id_json', 'required');
     $this->formcheck();
     // Receiving parameter
     $promotion_id_json = t_Post("promotion_id_json");
     $promotion_id_json = json_decode($promotion_id_json, true);
     // Business logic
     $dataLIst = $this->root_promotion_model->delete($promotion_id_json);
     //response
     if (!$dataLIst) {
         resdie(array(), "can not delete promotion");
     }
     resOk($dataLIst);
 }
Example #5
0
 public function update_sort()
 {
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('sort', 'trim|required');
     $this->form_validation->set_rules('sorted', 'trim|required');
     $this->formCheck();
     // Receiving parameter
     $referral_sort = t_Post('sort');
     $referral_sorted = t_Post('sorted');
     // Business logic
     $this->mLoadModel('referral_model');
     try {
         $order = explode('&', $referral_sort);
         $order = explode('||', $order[0]);
         $order = $order[1]--;
         $sorted = explode('&', $referral_sorted);
         foreach ($sorted as $sort) {
             $sort = explode('||', $sort);
             $referral_id = str_replace('id=', '', $sort[0]);
             $dbData = array();
             $dbData['update_time'] = time();
             $dbData['sort_index'] = $order++;
             $this->referral_model->update($dbData, $referral_id);
         }
     } catch (Exception $e) {
         resDie($e->getMessage());
     }
     // Response
     resOk();
 }
Example #6
0
 public function crop_rect()
 {
     $this->load->library('form_validation');
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('txt_image_id', 'trim|required|numeric');
     $this->form_validation->set_rules('txt_crop_rect_json', 'trim|required');
     $this->formCheck();
     $txt_image_id = t_Post("txt_image_id");
     $cropRectData = json_decode(t_Post("txt_crop_rect_json"), true);
     $this->load->model("root_image_model");
     $result = $this->root_image_model->cropRectImageById($txt_image_id, $cropRectData);
     resOk($result);
 }
Example #7
0
 public function bulk_delete()
 {
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('ids', 'trim|required');
     $this->formCheck();
     // Receiving parameter
     $staff_group_ids = t_Post('ids');
     // Business logic
     $staff_group_ids = explode(',', $staff_group_ids);
     if (!is_array($staff_group_ids)) {
         resDie("Cannot delete staff data");
     }
     $this->mLoadModel('staff_group_model');
     try {
         $this->staff_group_model->batch_delete($staff_group_ids);
     } catch (Exception $e) {
         resDie($e->getMessage());
     }
     // Response
     resOk();
 }
Example #8
0
 function bulk_delete_customer()
 {
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('id', 'trim|required');
     $this->form_validation->set_rules('customerIds', 'trim|required');
     $this->formCheck();
     // Receiving parameter
     $customer_group_id = t_Post('id');
     $customer_customer_ids = t_Post('customerIds');
     // Business logic
     $customer_customer_ids = explode(',', $customer_customer_ids);
     if (!is_array($customer_customer_ids)) {
         resDie("Cannot delete customer data");
     }
     $this->mLoadModel('customer_mathto_customer_group_model');
     try {
         $this->customer_mathto_customer_group_model->delete_customer($customer_group_id, $customer_customer_ids);
     } catch (Exception $e) {
         resDie($e->getMessage());
     }
     // Response
     resOk();
 }
Example #9
0
 public function delete()
 {
     // authentication none
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('txt_badge_id_json', 'required');
     $this->formcheck();
     // Receiving parameter
     $badge_id_json = t_Post("txt_badge_id_json");
     $badge_id_json = json_decode($badge_id_json, true);
     // Business logic
     $dataLIst = $this->root_badge_model->delete($badge_id_json);
     // deletebadge
     //response
     resOk($dataLIst);
 }