123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- // +----------------------------------------------------------------------
- // | Niucloud-admin 企业快速开发的saas管理平台
- // +----------------------------------------------------------------------
- // | 官方网址:https://www.niucloud.com
- // +----------------------------------------------------------------------
- // | niucloud团队 版权所有 开源版本可自由商用
- // +----------------------------------------------------------------------
- // | Author: Niucloud Team
- // +----------------------------------------------------------------------
- namespace app\service\admin\shop\site;
- use app\model\shop\ShopAccountLog;
- use core\base\BaseAdminService;
- /**
- * 店铺账单记录服务层
- * Class ShopService
- * @package app\service\admin\shop\site
- */
- class ShopAccountLogService extends BaseAdminService
- {
- public function __construct()
- {
- parent::__construct();
- $this->model = new ShopAccountLog();
- }
- /**
- * 获取账户收支记录
- */
- public function getPage(array $where = []):array
- {
- $field = 'id, related_id, from_type, money, create_time, memo';
- $order = 'create_time desc';
- $search_model = $this->model
- ->withSearch(['from_type', 'related_id', 'create_time'], $where)
- ->where([['site_id', '=', $this->site_id]])->append([ 'from_type_name' ])->field($field)->order($order);
- $list = $this->pageQuery($search_model);
- return $list;
- }
- /**
- * 添加账户收支记录
- * @param array $data
- * @return mixed
- */
- public function add(array $data)
- {
- $data[ 'create_time' ] = time();
- $res = $this->model->create($data);
- return $res->id;
- }
- }
|