Commit 16cf8a6f authored by zhuwei's avatar zhuwei

1

parent f6ff2369
<?php
namespace app\index\controller;
use app\index\extend\Basic;
use app\api\service\ActivityService;
use app\model\CActivity;
use think\Request;
/**
* 成本明细
* Created by PhpStorm.
* User: zw
* Date: 2019-07-19
* Time: 13:22:17
*/
class CostDetail extends Basic
{
private $activityService;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->activityService = new ActivityService();
}
/**
* 获取活动列表
* doc url :http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=818
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getActivityList()
{
$params = $this->params;
/* $params = array(
"id" => 1,
"title" => "asd",
"pageNo" => 1,
"pageSize" => 15,
);*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$activityModel = new CActivity();
$field = 'id,title,return_type,money,return_action,activity_start_time,activity_end_time,use_period,total,
available,get_number,activity_rule,status,create_time';
$where_ = [];
if (!empty($params["title"])) {
$where_["title"] = array("like", "%" . trim($params['title']) . "%");
}
if (!empty($params["id"])) {
$where_["id"] = $params['id'];
}
$where_["status"] = array("neq", 4);
$list = $activityModel->getActivityList($field, $where_, $pageNo, $pageSize);
$count = $activityModel->getActivityCount($field, $where_);
$result["list"] = $list;
$result["total"] = $count;
return $this->response("200", "success", $result);
}
}
\ No newline at end of file
......@@ -249,7 +249,7 @@ class StoreFee extends Basic
// $params = array(
// "id" => '1',//id
// );[ 'office_id', 'store_id' ]
// );
$checkResult = $this->validate($params, "StoreFeeValidate.bindStore");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
......
<?php
namespace app\model;
use think\Db;
use think\Model;
class FStoreCostExt extends BaseModel
{
protected $table = 'f_store_cost_ext';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* 查询数据
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getStoreCostExt($field,$params,$pageNo, $pageSize)
{
$result = $this->db_
->field($field)
->where($params)
->limit($pageSize)
->page($pageNo)
->select();
return $result;
}
public function getStoreCostExtTotal($field,$params)
{
$result = $this->db_
->field($field)
->where($params)
->count();
return $result;
}
}
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