main
yangsai 1 month ago
parent 5c4808690b
commit 14e7e998a0
  1. 7
      application/admin/controller/Content.php
  2. 36
      application/admin/model/Content.php
  3. 10
      application/admin/model/Order.php
  4. 3
      application/admin/model/content/Pinglun.php
  5. 9
      application/admin/model/system/Fankui.php
  6. 1
      application/api/controller/Content.php
  7. 2
      application/api/controller/User.php
  8. BIN
      public.rar
  9. 9
      public/assets/js/backend/content.js

@ -68,5 +68,12 @@ class Content extends Backend
$this->view->assign("statusList", $this->model->getStatusList());
return $this->view->fetch();
}
public function change(){
$id = $this->request->post('ids');
$info = $this->model->get($id);
$info->is_hot = $info['is_hot']?0:1;
if($info->save()); return $this->success("操作成功");
return $this->error("操作失败");
}
}

@ -31,7 +31,11 @@ class Content extends Model
'is_pay',
'type_tag',
];
protected static function init()
{
}
public function getStatusList()
{
return ['0' => __('审核中'),'1' => __('审核通过'),'-1' => __('审核驳回')];
@ -42,8 +46,19 @@ class Content extends Model
$type = ContentType::get($data['content_type_id']);
return $type->is_pay;
}
protected function setMainPhoneAttr($value)
{
$value = $this->maskPhoneNumber($value);
return $value;
}
protected function setMainCardnoAttr($value)
{
$value = $this->maskPhoneNumber($value);
return $value;
}
public function getMoneyAttr($value, $data)
{
//查询当前所属类型的费用
$type = ContentType::get($data['content_type_id']);
if($type->is_pay){
@ -56,11 +71,7 @@ class Content extends Model
{
//查询当前所属类型的费用
$type = ContentType::get($data['content_type_id']);
if($type->is_pay){
return $type['tag'];
}else{
return '';
}
return $type['tag'];
}
// 查询当前用户是否已经付过费
public function getlist($where, $order, $offset, $limit,$uid=0){
@ -131,6 +142,8 @@ class Content extends Model
$order = Order::where(['content_id'=>$item['id'],'user_id'=>$uid,'status'=>1])->find();
$item['payed'] = $order||$item['user_id']==$uid?1:0;
$item['content_tag'] = json_decode($item['content_tag'],true);
$item['main_phone'] = $this->maskPhoneNumber($item['main_phone']);
$item['main_cardno'] = $this->maskPhoneNumber($item['main_cardno']);
});
$result = array("total" => $list->total(), "rows" => $list->items(),"sql"=>$this->fetchSql());
return $result;
@ -142,4 +155,15 @@ class Content extends Model
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function maskPhoneNumber($idNumber) {
// 假设身份证号码是18位,手机号码是11位,位于第11至第21位
if (strlen($idNumber) == 11) {
return substr_replace($idNumber, '****', 3, 4);
}elseif(strlen($idNumber) == 18){
return substr_replace($idNumber, '****', 14, 4);
}else{
return $idNumber;
}
}
}

@ -33,12 +33,20 @@ class Order extends Model
$order = empty($order)?['o.createtime'=>"desc"]:$order;
$list = $this->field("o.id,o.user_id,o.createtime,order_no,title,o.money,paytime,content_id,ispay,user_money,system_money,o.status,type,f.user_id as fabu_user_id,f.title")->alias('o')->join('fa_content f','f.id = o.content_id','LEFT')
->where($where)
->where('ispay',1)
->paginate($limit);
// ->paginate(['page'=> $offset?? 1,'list_rows' => $limit]);
$result = array("total" => $list->total(), "rows" => $list->items(),"sql"=>$this->fetchSql());
return $result;
}
public function getlistapi($where, $order, $offset, $limit,$sort){
$order = empty($order)?['o.createtime'=>"desc"]:$order;
$list = $this->field("o.id,o.user_id,o.createtime,order_no,title,o.money,paytime,content_id,ispay,user_money,system_money,o.status,type,f.user_id as fabu_user_id,f.title")->alias('o')->join('fa_content f','f.id = o.content_id','LEFT')
->where($where)
// ->paginate($limit);
->paginate(['page'=> $offset?? 1,'list_rows' => $limit]);
$result = array("total" => $list->total(), "rows" => $list->items(),"sql"=>$this->fetchSql());
return $result;
}
// 查询当前用户是否已经付过费
public function yungudong($where, $order, $offset, $limit,$sort,$type){
$order = empty($order)?['o.createtime'=>"desc"]:$order;

@ -59,7 +59,4 @@ class Pinglun extends Model
return empty($user)?'用户已注销':$user['nickname'];
}
}

@ -26,8 +26,15 @@ class Fankui extends Model
// 追加属性
protected $append = [
'nickname'
];
public function getNicknameAttr($value, $data)
{
//查询用户信息
$user = \app\admin\model\User::get($data['user_id']);
return empty($user)?'':$user['nickname'];
}
public function getlist($where, $order, $offset, $limit){
$list = $this->where($where)
->order($order)

@ -57,6 +57,7 @@ class Content extends Api
$offset = $data['offset'];
$limit = $data['limit'];
$list = $this->model->getlist($where, $order, $offset, $limit,$uid);
$list['showinfo'] = $list['total']&&$list['total']<=2?$list['rows']:[$list['rows'][0],$list['rows'][1]];
return $this->success('获取成功',$list);
}
return $this->error("非法请求");

@ -499,7 +499,7 @@ class User extends Api
$order = ['o.createtime'=>'desc'];
$offset = $data['offset'];
$limit = $data['limit'];
$list = $Order->getlist($where, $order, $offset, $limit);
$list = $Order->getlistapi($where, $order, $offset, $limit,[]);
foreach($list['rows'] as $k=>&$v){
$v['title'] = $v['type']==2?'开通云股东':$v['title'];
}

Binary file not shown.

@ -35,6 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'main_realname', title: __('Main_realname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'main_phone', title: __('Main_phone'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'main_cardno', title: __('Main_cardno'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'is_hot', title: __('是否热门'), operate: false, formatter: Controller.api.formatter.custom},
// {field: 'main_qq', title: __('Main_qq'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'main_wechat', title: __('Main_wechat'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'main_address', title: __('Main_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
@ -199,7 +200,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
},
formatter: {//渲染的方法
custom: function (value, row, index) {
//添加上btn-change可以自定义请求的URL进行数据处理
return '<a class="btn-change text-success" data-url="content/change" data-confirm="确认设为或者取消热门?" data-id="' + row.id + '"><i class="fa ' + (row.is_hot == 0 ? 'fa-toggle-on fa-flip-horizontal text-gray' : 'fa-toggle-on') + ' fa-2x"></i></a>';
},
},
}
};
return Controller;

Loading…
Cancel
Save