|
@@ -6,6 +6,7 @@ namespace app\zskk\servies;
|
|
|
use app\admin\model\dict\Commondata;
|
|
|
use app\admin\servies\bi\BaseQcBiServies;
|
|
|
use app\zskk\model\BiInspectReport;
|
|
|
+use app\zskk\model\Chineseprovinces;
|
|
|
use app\zskk\model\ExamReport;
|
|
|
use app\zskk\model\HrRecord;
|
|
|
use app\zskk\model\InspectReport;
|
|
@@ -18,11 +19,13 @@ class WechatServies
|
|
|
{
|
|
|
public $postcardModel = null;
|
|
|
public $wechatuserModel = null;
|
|
|
- public function __construct(WechatUser $wechatuserModel,Postcard $postcardModel)
|
|
|
+ public $provinces = null;
|
|
|
+ public function __construct(WechatUser $wechatuserModel,Postcard $postcardModel,Chineseprovinces $chineseprovinces)
|
|
|
{
|
|
|
// parent::__construct();
|
|
|
$this->postcardModel = $postcardModel;
|
|
|
$this->wechatuserModel = $wechatuserModel;
|
|
|
+ $this->provinces = $chineseprovinces;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -48,14 +51,17 @@ class WechatServies
|
|
|
public function getCard($params)
|
|
|
{
|
|
|
$where = [];
|
|
|
+ $ageWhere = [];
|
|
|
if(!empty($params['age'])){
|
|
|
- $where[] = ['age','between',explode(',',$params['age'])];
|
|
|
+ $age1 = (int)$params['age'][0];
|
|
|
+ $age2 = (int)$params['age'][1];
|
|
|
+ $ageWhere = " age between $age1 and $age2";
|
|
|
}
|
|
|
if(!empty($params['sex'])){
|
|
|
$where['sex'] = $params['sex'];
|
|
|
}
|
|
|
if(!empty($params['depart'])){
|
|
|
- $where[] = ['depart' ,'in',explode(',',$params['depart'])];
|
|
|
+ $where[] = ['depart' ,'in',$params['depart']];
|
|
|
}
|
|
|
if(!empty($params['title'])){
|
|
|
$where['title'] = $params['title'];
|
|
@@ -63,22 +69,23 @@ class WechatServies
|
|
|
if(!empty($params['area'])){
|
|
|
$where['area'] = $params['area'];
|
|
|
}
|
|
|
- $list = $this->postcardModel->where($where)->page((int)$params['page'],(int)$params['num'])->select()->toArray();
|
|
|
+ $list = $this->postcardModel->where($where)->where($ageWhere)->page((int)$params['page'],(int)$params['num'])->select()->toArray();
|
|
|
$total = $this->postcardModel->where($where)->count();
|
|
|
return ['list'=>$list,'total'=>$total];
|
|
|
}
|
|
|
|
|
|
- public function getOneCard($params)
|
|
|
+ public function updateOneCard($params)
|
|
|
{
|
|
|
$id = $params['id'];
|
|
|
- $list = $this->postcardModel->where('id',$id)->find()->toArray();
|
|
|
+ unset($params['id']);
|
|
|
+ $list = $this->postcardModel->where('ID',$id)->update($params);
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
public function delCard($params)
|
|
|
{
|
|
|
$id = $params['id'];
|
|
|
- $list = $this->postcardModel->where('id',$id)->delete();
|
|
|
+ $list = $this->postcardModel->where('ID',$id)->delete();
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
@@ -92,4 +99,9 @@ class WechatServies
|
|
|
{
|
|
|
$this->postcardModel->saveAll($arr);
|
|
|
}
|
|
|
+
|
|
|
+ public function getArea()
|
|
|
+ {
|
|
|
+ return $this->provinces->field('NAME AS id,NAME AS name')->select()->toArray();
|
|
|
+ }
|
|
|
}
|