作者 王智

daima

... ... @@ -175,5 +175,9 @@
$("#c-zhao_id_text").data("selectPageObject").option.data = 'user/index?pid=2';
}
var value = $('#c-type').val();
console.log(value);
</script>
... ...
... ... @@ -196,6 +196,8 @@ class Common extends Api
//订单生成
public function addOrder()
{
$map2['endtime'] = ['LT', time()];
Db::name('renwu')->where($map2)->delete();
$map['type'] = ['eq', 1];
$map1['updatetime'] = ['GT', time() - 86400];
Db::name('renwu')->where($map)->where($map1)->update(
... ...
... ... @@ -248,18 +248,30 @@ class User extends Api
{
$param = $this->request->param();
$user_id = $this->is_token($this->request->header());
$mobile = Db::name('user')->where('id', $user_id)->value('mobile');
$this->CheckCode($mobile, $param['code']);
$data = [
'mobile' => $param['mobile'],
'car_num' => $param['car_num'],
'car_type' => $param['car_type'],
'color' => $param['color'],
'address' => $param['address'],
'address_con' => $param['address_con'],
'lng' => $param['lng'],
'lat' => $param['lat'],
];
if (!empty($param['mobile']) || $param['mobile'] != '' || $param['mobile'] != "" || $param['mobile'] != null) {
$mobile = Db::name('user')->where('id', $user_id)->value('mobile');
$this->CheckCode($mobile, $param['code']);
$data = [
'mobile' => $param['mobile'],
'car_num' => $param['car_num'],
'car_type' => $param['car_type'],
'color' => $param['color'],
'address' => $param['address'],
'address_con' => $param['address_con'],
'lng' => $param['lng'],
'lat' => $param['lat'],
];
} else {
$data = [
'car_num' => $param['car_num'],
'car_type' => $param['car_type'],
'color' => $param['color'],
'address' => $param['address'],
'address_con' => $param['address_con'],
'lng' => $param['lng'],
'lat' => $param['lat'],
];
}
$res = Db::name('user')->where('id', $user_id)->update($data);
if (!$res) {
$this->error('请填写完整信息', 0);
... ... @@ -418,6 +430,7 @@ class User extends Api
public function MyOrder()
{
$user_id = $this->is_token($this->request->header());
$this->orderTime($user_id);
$param = $this->request->param();
if ($param['type'] == 1) {
$map = [];
... ...
... ... @@ -350,7 +350,6 @@ class Api
}
//计算距离
function getDistance($lng1, $lat1, $lng2, $lat2, $unit = 2, $decimal = 2)
{
... ... @@ -454,4 +453,29 @@ class Api
$this->error(__('验证码不正确'));
}
}
//检查到期订单
public function orderTime($UserId)
{
$map['createtime'] = ['LT', time() - 60 * 30];
$Arr = Db::name('order')->where('user_id', $UserId)
->where('status', 0)
->where($map)
->select();
if (!empty($Arr)) {
$res = Db::name('order')->where('user_id', $UserId)
->where('status', 0)
->where($map)
->update(
[
'status' => 2,
'updatetime' => time()
]
);
if (!$res) {
$this->error('订单状态获取失败', 0);
}
}
}
}
... ...