Sfoglia il codice sorgente

权益卡后台下单

liugc 1 anno fa
parent
commit
4197c4f28e

+ 117 - 0
app/adminapi/controller/equity/EquityOrderController.php

@@ -0,0 +1,117 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+
+namespace app\adminapi\controller\equity;
+
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\equity\EquityOrderLists;
+use app\adminapi\logic\equity\EquityOrderLogic;
+use app\adminapi\validate\equity\EquityOrderValidate;
+
+
+/**
+ * EquityOrder控制器
+ * Class EquityOrderController
+ * @package app\adminapi\controller
+ */
+class EquityOrderController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function lists()
+    {
+        return $this->dataLists(new EquityOrderLists());
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function add()
+    {
+        $params = (new EquityOrderValidate())->post()->goCheck('add');
+        $result = EquityOrderLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(EquityOrderLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function edit()
+    {
+        $params = (new EquityOrderValidate())->post()->goCheck('edit');
+        $result = EquityOrderLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(EquityOrderLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function delete()
+    {
+        $params = (new EquityOrderValidate())->post()->goCheck('delete');
+        EquityOrderLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function detail()
+    {
+        $params = (new EquityOrderValidate())->goCheck('detail');
+        $result = EquityOrderLogic::detail($params);
+        return $this->data($result);
+    }
+
+    public function addOrder()
+    {
+        $params = (new EquityOrderValidate())->post()->goCheck('detail');
+        $result = EquityOrderLogic::addOrder($params);
+        if (false === $result) {
+            return $this->fail(EquityOrderLogic::getError());
+        }
+        return $this->success('下单成功', [], 1, 1);
+    }
+
+}

+ 83 - 0
app/adminapi/lists/equity/EquityOrderLists.php

@@ -0,0 +1,83 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\equity;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\equity\EquityOrder;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\user\User;
+
+
+/**
+ * EquityOrder列表
+ * Class EquityOrderLists
+ * @package app\adminapi\lists
+ */
+class EquityOrderLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function setSearch(): array
+    {
+        if(isset($this->params['mobile']) && !empty($this->params['mobile'])){
+            $userId = User::where('mobile',$this->params['mobile'])->value('id')??-1;
+            $this->params['user_id'] = $userId;
+        }
+        return [
+            '=' => ['user_id', 'description', 'price', 'create_order_time', 'service_work_id', 'equity_id', 'status', 'property_head_id', 'remark'],
+
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function lists(): array
+    {
+        return EquityOrder::with(['equityConfig','user','propertyHead','serviceWork'])->where($this->searchWhere)
+            ->field(['id', 'user_id', 'description', 'price', 'create_order_time', 'service_work_id', 'equity_id', 'status', 'property_head_id', 'remark'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function count(): int
+    {
+        return EquityOrder::where($this->searchWhere)->count();
+    }
+
+}

+ 3 - 2
app/adminapi/lists/sale/PropertyHeadAnalysisLists.php

@@ -39,7 +39,7 @@ class PropertyHeadAnalysisLists extends BaseAdminDataLists implements ListsSearc
     public function setSearch(): array
     public function setSearch(): array
     {
     {
         return [
         return [
-            '=' => ['sale_group_id', 'property_head_id','sale_type', 'sale_id'],
+            '=' => ['a.sale_group_id', 'a.property_head_id','a.sale_type', 'a.sale_id'],
 
 
         ];
         ];
     }
     }
@@ -74,7 +74,8 @@ class PropertyHeadAnalysisLists extends BaseAdminDataLists implements ListsSearc
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(b.work_amount) AS total_sales_amount")
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(b.work_amount) AS total_sales_amount")
             ])
             ])
             ->where('a.sale_type', 'in', [1, 2])
             ->where('a.sale_type', 'in', [1, 2])
-            //->where('a.order_status', 3)
+            ->where($this->searchWhere)
+            ->where($this->queryWhere())
             ->where('b.service_status', 3)
             ->where('b.service_status', 3)
             ->group('a.property_head_id')
             ->group('a.property_head_id')
             ->limit($this->limitOffset, $this->limitLength)
             ->limit($this->limitOffset, $this->limitLength)

+ 2 - 1
app/adminapi/lists/sale/SaleAnalysisLists.php

@@ -39,7 +39,7 @@ class SaleAnalysisLists extends BaseAdminDataLists implements ListsSearchInterfa
     public function setSearch(): array
     public function setSearch(): array
     {
     {
         return [
         return [
-            '=' => ['sale_group_id', 'property_head_id','sale_type', 'sale_id'],
+            '=' => ['a.sale_group_id', 'a.property_head_id','a.sale_type', 'a.sale_id'],
 
 
         ];
         ];
     }
     }
@@ -73,6 +73,7 @@ class SaleAnalysisLists extends BaseAdminDataLists implements ListsSearchInterfa
                 'a.sale_id','c.sale_name','c.mobile',
                 'a.sale_id','c.sale_name','c.mobile',
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(CASE WHEN a.sale_type = 1 THEN b.work_amount ELSE 0 END) AS amount_sales_agent,SUM(CASE WHEN a.sale_type = 2 THEN b.work_amount ELSE 0 END) AS amount_sales_individual,COUNT(CASE WHEN a.sale_type = 1 THEN a.work_id ELSE null END) AS count_sales_agent,COUNT(CASE WHEN a.sale_type = 2 THEN a.work_id ELSE null END) AS count_sales_individual")
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(CASE WHEN a.sale_type = 1 THEN b.work_amount ELSE 0 END) AS amount_sales_agent,SUM(CASE WHEN a.sale_type = 2 THEN b.work_amount ELSE 0 END) AS amount_sales_individual,COUNT(CASE WHEN a.sale_type = 1 THEN a.work_id ELSE null END) AS count_sales_agent,COUNT(CASE WHEN a.sale_type = 2 THEN a.work_id ELSE null END) AS count_sales_individual")
             ])
             ])
+            ->where($this->searchWhere)
             ->where($this->queryWhere())
             ->where($this->queryWhere())
             ->where('a.sale_type', 'in', [1, 2])
             ->where('a.sale_type', 'in', [1, 2])
             //->where('a.order_status', 3)
             //->where('a.order_status', 3)

+ 3 - 2
app/adminapi/lists/sale/SaleGroupAnalysisLists.php

@@ -39,7 +39,7 @@ class SaleGroupAnalysisLists extends BaseAdminDataLists implements ListsSearchIn
     public function setSearch(): array
     public function setSearch(): array
     {
     {
         return [
         return [
-            '=' => ['sale_group_id', 'property_head_id','sale_type', 'sale_id'],
+            '=' => ['a.sale_group_id', 'a.property_head_id','a.sale_type', 'a.sale_id'],
 
 
         ];
         ];
     }
     }
@@ -73,7 +73,8 @@ class SaleGroupAnalysisLists extends BaseAdminDataLists implements ListsSearchIn
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(b.work_amount) AS total_sales_amount")
                 Db::raw("COUNT(a.work_id) AS work_count,SUM(b.work_amount) AS total_sales_amount")
             ])
             ])
             ->where('a.sale_type', 'in', [1, 2])
             ->where('a.sale_type', 'in', [1, 2])
-            //->where('a.order_status', 3)
+            ->where($this->searchWhere)
+            ->where($this->queryWhere())
             ->where('b.service_status', 3)
             ->where('b.service_status', 3)
             ->group('a.sale_group_id')
             ->group('a.sale_group_id')
             ->limit($this->limitOffset, $this->limitLength)
             ->limit($this->limitOffset, $this->limitLength)

+ 201 - 0
app/adminapi/logic/equity/EquityOrderLogic.php

@@ -0,0 +1,201 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\logic\equity;
+
+
+use app\adminapi\logic\property\PropertyOrderLogic as AdminPropertyOrderLogic;
+use app\adminapi\logic\user\UserLogic;
+use app\api\logic\PropertyOrderLogic as ApiPropertyOrderLogic;
+use app\common\model\equity\EquityConfig;
+use app\common\model\equity\EquityOrder;
+use app\common\logic\BaseLogic;
+use app\common\model\equity\UserEquity;
+use app\common\model\property\PropertyOrder;
+use app\common\model\user\User;
+use Exception;
+use think\facade\Db;
+
+
+/**
+ * EquityOrder逻辑
+ * Class EquityOrderLogic
+ * @package app\adminapi\logic
+ */
+class EquityOrderLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            // 通过手机号查询用户是否注册 - 已注册绑定id ,未注册注册再绑定id
+            $userId = UserLogic::getUserIdByMobile($params['mobile']);
+
+            EquityOrder::create([
+                'user_id' => $userId,
+                'description' => $params['description']??'',
+                'price' => $params['price']??0,
+                'create_order_time' => $params['create_order_time']?strtotime($params['create_order_time']):0,
+                'service_work_id' => $params['service_work_id']??0,
+                'equity_id' => $params['equity_id']??0,
+                'status' => $params['status']??1,
+                'property_head_id' => $params['property_head_id']??0,
+                'remark' => $params['remark']??'',
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 编辑
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            // 通过手机号查询用户是否注册 - 已注册绑定id ,未注册注册再绑定id
+            $userId = UserLogic::getUserIdByMobile($params['mobile']);
+
+            EquityOrder::where('id', $params['id'])->update([
+                'user_id' => $userId,
+                'description' => $params['description']??'',
+                'price' => $params['price']??0,
+                'create_order_time' => $params['create_order_time']?strtotime($params['create_order_time']):0,
+                'service_work_id' => $params['service_work_id']??0,
+                'equity_id' => $params['equity_id']??0,
+                'status' => $params['status']??1,
+                'property_head_id' => $params['property_head_id']??0,
+                'remark' => $params['remark']??'',
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public static function delete(array $params): bool
+    {
+        return EquityOrder::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public static function detail($params): array
+    {
+        return EquityOrder::findOrEmpty($params['id'])->toArray();
+    }
+
+
+    public static function addOrder($params)
+    {
+        Db::startTrans();
+        try {
+            $equityOrder = EquityOrder::findOrEmpty($params['id'])->toArray();
+            $userInfo = User::findOrEmpty($equityOrder['user_id'])->toArray();
+            $equityConfigInfo = EquityConfig::findOrEmpty($params['equity_id'])->toArray();
+
+            $userEquity = UserEquity::where([
+                ['equity_id','=',$params['equity_id']],['user_id','=',$equityOrder['user_id']],
+                ['number','>',0],['end_time','>=',time()]
+            ])->findOrEmpty();
+            if($userEquity->isEmpty()){
+                $userEquity = UserEquity::create([
+                    'user_id' => $equityOrder['user_id'],
+                    'equity_id' => $params['equity_id'],
+                    'remark' => $params['remark']??'',
+                    'goods_id' => $equityConfigInfo['goods_id'],
+                    'number' => $equityConfigInfo['number'],
+                    'end_time' => (time()+$equityConfigInfo['day_num']*86400),
+                ]);
+            }
+            $order_id = ApiPropertyOrderLogic::add([
+                'property_head_id' => $equityOrder['property_head_id'],
+                'householder_name' => $userInfo['nickname'],
+                'householder_mobile' => $userInfo['mobile'],
+                'address' => $params['address']??'',
+                'remark' => ''
+            ]);
+            if (false === $order_id) {
+                throw new Exception(ApiPropertyOrderLogic::getError());
+            }
+            $result = AdminPropertyOrderLogic::placeOrder([
+                'id' => $order_id,
+                'address' => $params['address'] ?? '',
+                'appointment_time' => $params['appointment_time'],
+                'goods_id' => $equityConfigInfo['goods_id'],
+                'pay_way' => $params['pay_way'],
+                'contact_number' => $params['contact_number'] ?? '',
+                'contact_people' => $params['contact_people'] ?? '',
+                'user_equity_id' => $userEquity->id
+            ]);
+            if (false === $result) {
+                throw new Exception(AdminPropertyOrderLogic::getError());
+            }
+
+            $orderInfo = PropertyOrder::where('id', $order_id)->findOrEmpty()->toArray();
+            EquityOrder::where('id', $params['id'])->update([
+                'service_work_id' => $orderInfo['work_id'],
+                'equity_id' => $params['equity_id'],
+                'status' => 2,
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+}

+ 110 - 0
app/adminapi/validate/equity/EquityOrderValidate.php

@@ -0,0 +1,110 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\validate\equity;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * EquityOrder验证器
+ * Class EquityOrderValidate
+ * @package app\adminapi\validate
+ */
+class EquityOrderValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'mobile' => 'require|mobile',
+        'description' => 'require',
+        'create_order_time' => 'require',
+        'service_work_id' => 'require',
+        'equity_id' => 'require',
+        'status' => 'require',
+        'property_head_id' => 'require',
+
+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'mobile' => '用户手机号',
+        'description' => '商品描述',
+        'create_order_time' => '预计创单时间',
+        'service_work_id' => '工单ID',
+        'equity_id' => '权益卡ID',
+        'status' => '状态:1未下单、2已下单',
+        'property_head_id' => '物业负责人ID',
+
+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return EquityOrderValidate
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['mobile','description','property_head_id']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return EquityOrderValidate
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','mobile','description','property_head_id']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return EquityOrderValidate
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return EquityOrderValidate
+     * @author likeadmin
+     * @date 2024/12/25 13:32
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 3 - 3
app/api/controller/PropertyController.php

@@ -46,10 +46,10 @@ class PropertyController extends BaseApiController
     {
     {
         $params = (new PropertyOrderValidate())->post()->goCheck('add');
         $params = (new PropertyOrderValidate())->post()->goCheck('add');
         $result = PropertyOrderLogic::add($params);
         $result = PropertyOrderLogic::add($params);
-        if (true === $result) {
-            return $this->success('下单成功', [], 1, 1);
+        if (false === $result) {
+            return $this->fail(PropertyOrderLogic::getError());
         }
         }
-        return $this->fail(PropertyOrderLogic::getError());
+        return $this->success('下单成功', [], 1, 1);
     }
     }
 
 
     /**
     /**

+ 3 - 3
app/api/logic/PropertyOrderLogic.php

@@ -70,7 +70,7 @@ class PropertyOrderLogic extends BaseLogic
      * @param array $params
      * @param array $params
      * @return bool
      * @return bool
      */
      */
-    public static function add(array $params): bool
+    public static function add(array $params)
     {
     {
         // 判断户主是否存在 返回户主id
         // 判断户主是否存在 返回户主id
         $propertyUserId = PropertyUserLogic::getPropertyUserIdByMobile($params);
         $propertyUserId = PropertyUserLogic::getPropertyUserIdByMobile($params);
@@ -78,7 +78,7 @@ class PropertyOrderLogic extends BaseLogic
         try {
         try {
             $propertyAddress = PropertyHead::where('id',$params['property_head_id'])->value('address');
             $propertyAddress = PropertyHead::where('id',$params['property_head_id'])->value('address');
             $address = $params['address']?(($propertyAddress?$propertyAddress.$params['address']:'')):'';
             $address = $params['address']?(($propertyAddress?$propertyAddress.$params['address']:'')):'';
-            PropertyOrder::create([
+            $res = PropertyOrder::create([
                 'property_head_id' => $params['property_head_id'],
                 'property_head_id' => $params['property_head_id'],
                 'property_user_id' => $propertyUserId,
                 'property_user_id' => $propertyUserId,
                 'remark' => $params['remark']??'',
                 'remark' => $params['remark']??'',
@@ -98,7 +98,7 @@ class PropertyOrderLogic extends BaseLogic
                     'phone_number11' => asteriskString($propertyUserInfo['householder_mobile']),
                     'phone_number11' => asteriskString($propertyUserInfo['householder_mobile']),
                 ]
                 ]
             ]);
             ]);
-            return true;
+            return $res->id;
         } catch (\Exception $e) {
         } catch (\Exception $e) {
             Db::rollback();
             Db::rollback();
             self::setError($e->getMessage());
             self::setError($e->getMessage());

+ 53 - 0
app/common/model/equity/EquityOrder.php

@@ -0,0 +1,53 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\equity;
+
+
+use app\common\model\BaseModel;
+use app\common\model\property\PropertyHead;
+use app\common\model\user\User;
+use app\common\model\works\ServiceWork;
+
+
+/**
+ * EquityOrder模型
+ * Class EquityOrder
+ * @package app\common\model
+ */
+class EquityOrder extends BaseModel
+{
+    
+    protected $name = 'equity_order';
+
+    public function equityConfig()
+    {
+        return $this->hasOne(EquityConfig::class, 'id', 'equity_id');
+    }
+
+    public function user()
+    {
+        return $this->hasOne(User::class, 'id', 'user_id');
+    }
+    public function propertyHead()
+    {
+        return $this->hasOne(PropertyHead::class, 'id', 'property_head_id')
+            ->field('id,property_name,village_name,head_name');
+    }
+    public function serviceWork()
+    {
+        return $this->hasOne(ServiceWork::class, 'id', 'service_work_id')
+            ->field('*');
+    }
+}