Commit cccdea4f authored by clone's avatar clone

1

parent c848bf58
......@@ -185,7 +185,7 @@ class DailyPaperService
$total_shop = $payLogModel->getTotal($field, $params, "pay_type");
$total_office = $officePayLogModel->getTotal($field, $params, "pay_type");
$total_arr = array_merge($total_shop, $total_office);
$total["alipay"] = 0;
$total["alipay_2"] = 0;
$total["alipay_3"] = 0;//陈志杰支付宝
......
<?php
namespace app\model;
use think\Db;
use think\Model;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/12/17
* Time : 11:26 AM
* Intro:
*/
class OfficeODaily extends BaseModel
{
protected $table = "office_o_daily";
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* @param $field
* @param $params
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDailyList($field, $params, $page_no, $page_size)
{
$where_ = [];
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
if (isset($params["daily_date"])) {
$where_["daily_date"] = $params["daily_date"];
}
if (isset($params["store_id"])) {
$where_["store_id"] = $params["store_id"];
}
if (isset($params['id'])) {
$where_["id"] = $params['id'];
}
$where_["is_del"] = 0;
return $this->db_
->field($field)
->where($where_)
->page($page_no)
->limit($page_size)
->select();
}
/**
* @param $params
* @return int
*/
public function addDaily($params)
{
Db::startTrans();
try {
$this->db_->insert($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* @param $where
* @param $params
* @return int
*/
public function updateDaily($where,$params)
{
Db::startTrans();
try {
$this->where($where)->update($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDailyLogList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->alias('a')
->field($field)
->join('o_daily_log b', 'a.id=b.daily_id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->group('a.id')
->page($pageNo)
->select();
}
/**
* @param $params
* @return int|string
*/
public function getDailyLogTotal($params) {
return $this->alias('a')
->join('o_daily_log b', 'a.id=b.daily_id', 'left')
->where($params)
->group('a.id')
->count();
}
public function getFieldValue($filed, $where) {
return $this->where($where)->value($filed);
}
}
\ No newline at end of file
<?php
namespace app\model;
use think\Db;
use think\Model;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/12/17
* Time : 2:36 PM
* Intro:
*/
class OfficeODailyLog extends BaseModel
{
protected $table = "office_o_daily_log";
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* @param $field
* @param $params
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDailyLogList($field,$params,$page_no,$page_size){
$where_ = [];
if(isset($params["daily_id"])){
$where_["daily_id"] = $params["daily_id"];
}
if(isset($params["operation_id"])){
$where_["operation_id"] = $params["operation_id"];
}
if(isset($params["operation_status"])){
$where_["operation_status"] = $params["operation_status"];
}
if(isset($params["is_del"])){
$where_["is_del"] = $params["is_del"];
}
return $this->db_
->field($field)
->where($where_)
->order("create_time desc")
->page($page_no)
->limit($page_size)
->select();
}
/**
* @param $params
* @return int
*/
public function addDailyCheck($params){
Db::startTrans();
try {
$this->db_->insert($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment