Ejemplo n.º 1
0
 public function add($dbData)
 {
     $tableName = "badge";
     $local_dbData = $this->makeDbDataForDbTable($dbData, $tableName, array("badge_id", "create_time", "update_time"));
     $local_dbData["create_time"] = time();
     $local_dbData["update_time"] = time();
     $ResDataID = $this->addData($local_dbData, $tableName);
     if (!$ResDataID) {
         resdie(array(), "! sumthing error in add process");
     }
     return $ResDataID;
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
 public function edit()
 {
     // authentication none
     // Form validation
     $this->form_validation->onlyPost();
     $this->form_validation->set_rules('txt_badge_id', 'required|numeric');
     $this->form_validation->set_rules('txt_badge_group_id', 'required|numeric');
     $this->form_validation->set_rules('txt_name', 'required');
     $this->form_validation->set_rules('txt_title', 'required');
     $this->form_validation->set_rules('txt_title2', 'required');
     $this->formcheck();
     // Receiving parameter
     $badge_id = t_Post('txt_badge_id');
     $txt_badge_group_id = t_Post('txt_badge_group_id');
     $txt_name = t_Post('txt_name');
     $txt_title = t_Post('txt_title');
     $txt_title2 = t_Post('txt_title2');
     // Business logic
     $dbData = array();
     $dbData['badge_group_id'] = $txt_badge_group_id;
     $dbData['name'] = $txt_name;
     $dbData['title'] = $txt_title;
     $dbData['title2'] = $txt_title2;
     $this->root_badge_model->edit($dbData, $badge_id);
     $ResData = $this->root_badge_model->getdataBadgeByID($badge_id);
     if (!$ResData) {
         resdie(array(), "can not update badge_group");
     }
     //response
     resOk($ResData);
 }