/** * 跟新订单 * @param $get * @param $post * @return \Lite\Core\Result|void */ public function update($get, $post) { $id = $get['id']; $order = $id ? BusinessOrder::findOneByPk($id) : new BusinessOrder(); if ($post) { $post['order_no'] = $order->order_no ?: BusinessOrder::generateOrderNo(); $r = Result::convert(parent::update($get, $post)); if ($r->isSuccess()) { $data = $r->getData(); $r->setJumpUrl(Router::getUrl('BusinessOrder/info', array('id' => $data['id']))); } return $r; } $pay_type_list = PayType::find('state = ?', PayType::STATE_ENABLED)->all(); $default_customer_list = Customer::find()->order(' id asc ')->limit(10)->all(); if ($order->customer_id) { $order_customer = Customer::find('id = ?', $order->customer_id)->all(); if ($order_customer) { $default_customer_list = array_merge($default_customer_list, $order_customer); } } $default_customer_contact_list = array(); if ($order->customer_id) { $default_customer_contact_list = CustomerContact::find('customer_id = ?', $order->customer_id)->all(true); } return array('order' => $order, 'order_type_list' => $order->getPropertiesDefine('order_type')['options'], 'pay_type_list' => $pay_type_list, 'default_customer_list' => $default_customer_list, 'default_customer_contact_list' => $default_customer_contact_list); }
public function update($get, $post) { if ($post) { $post['entry_time'] = $post['entry_time'] ?: 0; $post['leave_time'] = $post['leave_time'] ?: 0; $post['birthday'] = $post['birthday'] ?: 0; } return parent::update($get, $post); }
public function update($get, $post) { if ($post) { if ($post['password']) { $post['password'] = md5($post['password']); } else { unset($post['password']); } } return parent::update($get, $post); }
/** * @param $get * @param $post * @return \Lite\Core\Result */ public function update($get, $post) { if ($post) { $post['op_user_id'] = Auth::instance()->getLoginUserId(); } $result = parent::update($get, $post); if ($post) { $data = $result->getData(); $result->setJumpUrl(Router::getUrl('Customer/info', array('id' => $data['id']))); } return $result; }
/** * @param $get * @param $post * @return \Lite\Core\Result|void */ public function update($get, $post) { $id = $get['id']; $business_order_id = $get['business_order_id']; $r = Result::convert(parent::update($get, $post)); if ($post) { if ($r->isSuccess()) { if (!$id) { $order = BusinessOrder::findOneByPk($business_order_id); $order->setValue('state', BusinessOrder::STATE_CONFIRM); $order->save(); } $r->setJumpUrl($this->getBackUrl()); } } return $r; }
public function update($get, $post) { $result = Result::convert(parent::update($get, $post)); //接管提交成功后的处理 if ($post && $result->isSuccess()) { $id = $result->getData()['id']; $sample_type = Sample::findOneByPk($id)->sample_type; if ($sample_type == GlobalConf::SAMPLE_TYPE_SINGLE) { $ext = SingleSample::find('sample_id=?', $id)->one() ?: new SingleSample(array('sample_id' => $id)); unset($post['id']); $ext->setValues($post); $ext->save(); } $result->setJumpUrl(Router::getUrl('Sample/info', array('id' => $id))); } return $result; }
public function update($get, $post) { $order = SampleProduceOrder::findOneByPk($get['id']) ?: new SampleProduceOrder(); if ($post) { if ($post['produce_type'] == SampleProduceOrder::TYPE_ORDER) { if ($post['business_order_no']) { $post['business_order_id'] = BusinessOrder::find('order_no=?', $post['business_order_no'])->ceil('id'); } if (!$post['business_order_id']) { return new Result('您输入的订单号没有对应的订单:' . $post['business_order_no']); } } $org_id = $order->boss_head_employee_id; $order->setValues($post); if (!$order->id) { $order->boss_head_employee_id = Auth::instance()->getLoginUserId(); } else { $order->boss_head_employee_id = $org_id; } $result = parent::update($get, $post); if ($result->isSuccess()) { return new Result('操作成功', true); } } $customer_list = Customer::find()->all(); $current_contact_list = array(); if ($order->id) { $current_contact_list = CustomerContact::find('customer_id =?', $order->contact->customer_id)->all(); } $all_contact_list = CustomerContact::find()->all(true); $all_contact_list = array_group($all_contact_list, 'customer_id'); return array('order' => $order, 'customer_list' => $customer_list, 'all_contact_list' => $all_contact_list, 'current_contact_list' => $current_contact_list); }
public function update($get, $post) { $r = Result::convert(parent::update($get, $post)); if ($post && $r->isSuccess()) { $this->updateProduceOrderState($post['produce_order_id']); } return $r; }