58 lines
2.2 KiB
PHP
58 lines
2.2 KiB
PHP
<?php
|
|
namespace app\controllers\admin;
|
|
use Yii;
|
|
use yii\web\Controller;
|
|
class PlugController extends CommonController{
|
|
public $enableCsrfValidation = false;
|
|
//获取插件信息
|
|
public function actionGetpluglist(){
|
|
$request = Yii::$app->request;
|
|
if ($request->isGet){
|
|
$re= YII::$app->db->createCommand('select * from {{%ybwm_plug_unit}} where status=1')->queryAll();
|
|
$count=count($re);
|
|
return $this->result(1,'成功',$re,$count);
|
|
}
|
|
return $this->result(2,'请求异常');
|
|
}
|
|
//获取最新的插件信息前三名
|
|
public function actionGetplugtop(){
|
|
$request = Yii::$app->request;
|
|
if ($request->isGet){
|
|
$re= YII::$app->db->createCommand('select * from {{%ybwm_plug_unit}} where status=1 order by dt_operdate desc limit 3')->queryAll();
|
|
return $this->result(1,'成功',$re);
|
|
}
|
|
return $this->result(2,'请求异常');
|
|
}
|
|
|
|
//获取最新的插件信息前三名
|
|
public function actionGetplugsales(){
|
|
$request = Yii::$app->request;
|
|
if ($request->isGet){
|
|
$re= YII::$app->db->createCommand('select plug_name,price,count(*)as counts from {{%ybwm_plug_sales}} where ch_state=1 group by plug_id order by counts desc limit 3')->queryAll();
|
|
return $this->result(1,'成功',$re);
|
|
}
|
|
return $this->result(2,'请求异常');
|
|
}
|
|
|
|
//获取插件的购买记录
|
|
public function actionGetplugoper(){
|
|
$request = Yii::$app->request;
|
|
if ($request->isPost){
|
|
$result=axios_request();
|
|
$plug_type=$result['plug_type'];
|
|
$apply_name=$result['apply_name'];
|
|
$sql="select a.*,b.apply_name from {{%ybwm_plug_sales}} a left join {{%ybwm_apply}} b on a.unionid=b.id where ch_state=1";
|
|
if($plug_type>'0'){
|
|
$sql.=" and status='$plug_type'";
|
|
}
|
|
if($plug_type>'0'){
|
|
$sql.=" and apply_name='$apply_name'";
|
|
}
|
|
$re= YII::$app->db->createCommand($sql)->queryAll();
|
|
$count=count($re);
|
|
return $this->result(1,'成功',$re,$count);
|
|
}
|
|
return $this->result(2,'请求异常');
|
|
}
|
|
|
|
} |