| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?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\works;
- use app\common\model\BaseModel;
- /**
- * ServiceWorkSpare模型
- * Class ServiceWorkSpare
- * @package app\common\model
- */
- class ServiceWorkSpare extends BaseModel
- {
-
- protected $name = 'service_work_spare';
- protected $type = [
- 'spare_parts' => 'array'
- ];
- public static function getLists($service_work_id, $type = null) {
- $where = [];
- //商城工单配件
- if ($type == 1) {
- $where[] = ['spare_part_id','>', 0];
-
- } else if ($type == 2) {
- //自选工单配件
- $where[] = ['spare_part_id','=', 0];
- }
-
- $lists = self::where('service_work_id', $service_work_id)
- ->where($where)
- ->field("id,spare_part_id, spare_name, spare_image, company_price, original_price, offering_price, spare_number,spare_unit,brand")
- ->select()
- ->toArray();
- return $lists;
- }
-
- }
|