Esempio n. 1
0
 /**
  * 显示结算记录详情
  *
  * @param $f3
  */
 public function ajaxDetail($f3)
 {
     global $smarty;
     $errorMessage = '';
     // 参数验证
     $validator = new Validator($f3->get('GET'));
     $settle_id = $validator->required()->digits()->min(1)->validate('settle_id');
     if (!$this->validate($validator)) {
         $errorMessage = '结算ID非法';
         goto out;
     }
     // 加载 order_settle 记录
     $orderSettleService = new OrderSettleService();
     $orderSettle = $orderSettleService->loadOrderSettleBySettleId($settle_id);
     // 做权限检查
     $authSupplierUser = AuthHelper::getAuthUser();
     if ($orderSettle->isEmpty() || $authSupplierUser['suppliers_id'] !== $orderSettle['suppliers_id']) {
         $errorMessage = '结算ID非法';
         goto out;
     }
     $smarty->assign('settle_id', $settle_id);
     $smarty->assign('orderSettle', $orderSettle);
     out:
     $smarty->assign('errorMessage', $errorMessage);
     $smarty->display('order_settle_ajaxdetail.tpl');
 }
Esempio n. 2
0
 /**
  * 更新结算详情记录
  *
  * @param $f3
  */
 public function Update($f3)
 {
     // 权限检查
     $this->requirePrivilege('manage_order_settle_update');
     // 参数验证
     $validator = new Validator($f3->get('GET'));
     $settle_id = $validator->required()->digits()->min(1)->validate('settle_id');
     if (!$this->validate($validator)) {
         $this->addFlashMessage('结算ID非法');
         goto out;
     }
     // 加载 order_settle 记录
     $orderSettleService = new OrderSettleService();
     $orderSettle = $orderSettleService->loadOrderSettleBySettleId($settle_id);
     if ($orderSettle->isEmpty()) {
         $this->addFlashMessage('结算ID非法');
         goto out;
     }
     // 表单验证
     $validator = new Validator($f3->get('POST[orderSettle]'));
     $orderSettle->pay_type = $validator->validate('pay_type');
     $orderSettle->pay_no = $validator->validate('pay_no');
     $orderSettle->pay_time = Time::gmStrToTime($validator->validate('pay_time'));
     $orderSettle->memo = $validator->validate('memo');
     $orderSettle->save();
     $this->addFlashMessage('结算记录设置成功');
     out:
     RouteHelper::reRoute($this, RouteHelper::getRefer(), false);
 }