public function edit_post() { $data = $this->data; //取得公用數據 $orderid_Num = $this->input->post('orderid_Num', TRUE); //基本post欄位 $pay_account_Str = $this->input->post('pay_account_Str', TRUE); $pay_name_Str = $this->input->post('pay_name_Str', TRUE); $pay_paytime_Str = $this->input->post('pay_paytime_Str', TRUE); $pay_remark_Str = $this->input->post('pay_remark_Str', TRUE); $content_Str = $this->input->post('content_Str', TRUE); if (!empty($pay_account_Str) && !empty($pay_name_Str) && !empty($pay_paytime_Str)) { //建構OrderShop物件,並且更新 $OrderShop = new OrderShop(); $OrderShop->construct(array('orderid_Num' => $orderid_Num, 'pay_account_Str' => $pay_account_Str, 'pay_name_Str' => $pay_name_Str, 'pay_paytime_Str' => $pay_paytime_Str, 'pay_remark_Str' => $pay_remark_Str, 'pay_status_Num' => 1)); $OrderShop->update(array('db_update_Arr' => array('pay_account', 'pay_name', 'pay_paytime', 'pay_remark', 'pay_status'))); } if (!empty($content_Str)) { $Comment = new Comment(); $Comment->construct(['uid_Num' => $data['User']->uid_Num, 'typename_Str' => 'order', 'id_Num' => $orderid_Num, 'content_Str' => $content_Str]); $Comment->update(); } //送出成功訊息 $this->load->model('Message'); $this->Message->show(array('message' => '設定成功', 'url' => 'admin/user/order_shop/order_shop/tablelist')); }
public function set_recovery_post() { $OrderShopList = new ObjList(['db_where_Arr' => ['status' => -1], 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'OrderShop', 'limitstart_Num' => 0, 'limitcount_Num' => 100]); foreach ($OrderShopList->obj_Arr as $key => $value_order_shop) { $OrderShop = new OrderShop(['orderid_Num' => $value_order_shop->orderid_Num]); $OrderShop->recovery(); } if (!empty($OrderShopList->obj_Arr)) { $this->load->model('Message'); $this->Message->show(['message' => '復原成功', 'url' => 'admin/shop/order_shop/set/set']); } else { $this->load->model('Message'); $this->Message->show(['message' => '已無可復原的項目', 'url' => 'admin/shop/order_shop/set/set']); } }
public function delete() { $hash_Str = $this->input->get('hash'); $orderid_Num = $this->input->get('orderid'); $orderid_Arr = $this->input->post('orderid_Arr[]'); if (empty($orderid_Arr) && empty($orderid_Num)) { $this->load->model('Message'); $this->Message->show(array('message' => '未選擇要刪除的訂單', 'url' => 'admin/shop/order_shop/order_shop/tablelist')); } //CSRF過濾 if ($hash_Str == $this->security->get_csrf_hash()) { if (!empty($orderid_Num)) { $OrderShop = new OrderShop(['orderid_Num' => $orderid_Num]); $OrderShop->delete(); } if (!empty($orderid_Arr)) { foreach ($orderid_Arr as $key => $value_order) { $OrderShop = new OrderShop(['orderid_Num' => $value_order]); $OrderShop->delete(); } } $this->load->model('Message'); $this->Message->show(array('message' => '刪除成功', 'url' => 'admin/shop/order_shop/order_shop/tablelist')); } else { $this->load->model('Message'); $this->Message->show(array('message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/shop/order_shop/order_shop/tablelist')); } }
public function add_cart() { $data = $this->data; $productid_Num = $this->input->post('productid_Num', TRUE); $stockid_Num = $this->input->post('stockid_Num', TRUE); $amount_Num = $this->input->post('amount_Num', TRUE); if (empty($productid_Num) || empty($stockid_Num) || empty($amount_Num)) { $message_Str = '產品訊息傳遞錯誤'; $url_Str = 'order/cartlist'; $this->load->model('Message'); $this->Message->show(array('message' => $message_Str, 'url' => $url_Str)); } //讀取建構中的訂單 $OrderShop = new OrderShop(['db_where_Arr' => array('uid_Num' => $data['User']->uid_Num, 'order_status_Num' => -1)]); $data['transportList'] = new ObjList(['db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'Transport', 'limitstart_Num' => 0, 'limitcount_Num' => 100]); //如果沒有建構中的訂單則建立一個新的訂單 if (empty($OrderShop->orderid_Num)) { $OrderShop = new OrderShop(['uid_Num' => $data['User']->uid_Num, 'transport_mode_Str' => $data['transportList']->obj_Arr[0]->name_Str, 'transport_base_price_Num' => $data['transportList']->obj_Arr[0]->base_price_Num, 'transport_additional_price_Num' => $data['transportList']->obj_Arr[0]->additional_price_Num, 'pay_paytype_Str' => 'atm', 'order_status_Num' => -1]); $OrderShop->update(); } $OrderShop->add_cart(['productid_Num' => $productid_Num, 'stockid_Num' => $stockid_Num, 'amount_Num' => $amount_Num]); $OrderShop->update(); $url_Str = base_url('order/cartlist'); header("Location: {$url_Str}"); }