public function main_menu() { $shop_id = $this->onlyShop(); $this->load->model("menu_model"); $menuData = $this->menu_model->getCurrentMenuData($shop_id); resOk($menuData); }
public function gettotalamountforpackage($package_id = 12) { $sortby_id = "update_time"; $this->load->model("root_package_model"); $where_str = " product_matchto_package.package_id = {$package_id} "; $dataSend = $this->root_package_model->getTotalAmountForPackage($package_id, $where_str, $joinStr = ""); resOk($dataSend); }
function testrequest() { $print_data["allheaders"] = getallheaders(); $print_data["REQUEST_METHOD"] = @$_SERVER['REQUEST_METHOD']; $print_data["REQUEST"] = $_REQUEST; $print_data["GET"] = $_GET; $print_data["POST"] = $_POST; $print_data["FILES"] = $_FILES; $print_data["IP_ADDRESS"] = getenv("REMOTE_ADDR"); $print_data["timestamp"] = time(); resOk($print_data); }
public function file() { $this->load->model("root_file_model"); $uploadFileData = $this->root_file_model->upload("file_pdf"); resOk($uploadFileData); }
public function edit($product_id = 223) { $dbData = array(); $dbData["code"] = md5(time() . "-" . time()); $dbData["price"] = 90.0; $dbData["compare_price"] = 200.0; $dbData["title"] = " product title for : " . date("Y/m/d h : s : i ") . " : timestamp : " . time(); $dbData["description"] = " this is product description description for : " . date("Y/m/d h : s : i ") . " : timestamp : " . time(); $dbData["tags"] = "item, something111"; $this->load->model("root_deal_model"); $this->root_deal_model->edit($dbData, $product_id); $newProductData = $this->root_deal_model->getId($product_id); resOk($newProductData); }
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(); }
public function delete_pdf($product_id = 2) { $file_id_array = array(array("file_id" => 547)); $this->load->model("root_product_model"); $result = $this->root_product_model->deletePDFArray($product_id, $file_id_array); resOk($result); }
public function removeproductbefore($timestamp = "") { $timestamp = 1550456065; $dataLIst = $this->root_trash_product_model->removeProductBefore($timestamp); resOk($dataLIst); }
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); }
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(); }
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); }
public function search() { $search_txt = "title"; $cur_page = 1; $per_page = 10; $sortby_id = "product_lastest_create"; $where_str = " product_detail.title LIKE ? "; $param_ar = array("%" . $search_txt . "%"); $this->load->model("root_product_model"); $total_row = $this->root_product_model->getListsTotalRow($where_str, $param_ar); $dataList = $this->root_product_model->getLists($cur_page, $per_page, $sortby_id, $where_str, $param_ar); $dataSend = dataListSendFormat($total_row, $dataList, $cur_page, $per_page, $sortby_id); resOk($dataSend); }
public function get_shop_admin() { // Form validation $this->form_validation->onlyGet(); $this->form_validation->allRequest(); $this->formCheck(); // Business logic $this->mLoadModel('staff_model'); $shop_admin = $this->staff_model->get_shop_admin(); $response = []; if ($shop_admin) { $response = ['id' => $shop_admin['staff_id']]; } // Response resOk($response); }
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(); }
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(); }
public function upload_image() { $this->load->library("form_validation"); $this->form_validation->onlyPost(); $this->form_validation->set_rules("txt_name", "required|trim"); $this->form_validation->requireFile('txt_file'); $this->formCheck(); $txt_name = t_Request("txt_name"); //$dataSend["FILES"] = $_FILES; $this->load->model("root_image_model"); $uploadData = $this->root_image_model->uploadWithData('txt_file', array("title" => $txt_name)); /* foreach ($uploadData["successFiles"] as $key => $value) { if(@$value["db_file_id"]!=""){ $this->root_image_model->updateDataById($value["db_file_id"],array("title"=>$txt_name)); } } */ $this->logSave(); resOk($uploadData); }
public function rotate() { $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_rotate_degree', 'trim|required|numeric'); $this->formCheck(); $txt_image_id = t_Request("txt_image_id"); $txt_rotate_degree = t_Request("txt_rotate_degree"); $this->load->model("root_image_model"); $result = $this->root_image_model->rotateImageById($txt_image_id, $txt_rotate_degree); resOk($result); }
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(); }
public function enablelifetime($product_id = 222) { $this->load->model("product_model"); $dataLIst = $this->product_model->enableLifeTime($product_id); resOk($dataLIst); }
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(); }
protected function resOk($dataArray = array()) { resOk($dataArray, $this->methodName()); }