Setinfo.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. namespace App\Models;
  3. class Setinfo extends BaseModel {
  4. // const CREATED_AT = 'createTime';
  5. protected $table = "setinfo";
  6. // const UPDATED_AT = 'updateTime';
  7. public $timestamps = false;
  8. // protected $primaryKey = "id";
  9. //获得公告内容
  10. function getNotice(){
  11. $data=$this->where('id',19)->where('infotype',8)->first();
  12. if(!$data){
  13. return -6010000122;
  14. }
  15. return $data->toArray();
  16. }
  17. //获得弹框内容
  18. function getBoxOut(){
  19. $data=$this->where('infotype',6)->first();
  20. if(!$data){
  21. return -6010000222;//没有弹框信息
  22. }
  23. return $data->toArray();
  24. }
  25. //获取客服qq信息
  26. function getQQnumber(){
  27. $data=$this->where('infotype',16)->first();
  28. if(!$data){
  29. return -6010000322;//没有qq信息
  30. }
  31. return $data->toArray();
  32. }
  33. //获取代理模式开关信息
  34. function getAgentSet(){
  35. $data=$this->where('infotype',13)->first();
  36. if(!$data){
  37. return -6010000422;//获取设置信息失败
  38. }
  39. return $data->toArray();
  40. }
  41. //获取平台维护开关设置
  42. function getPlatSet(){
  43. $data=$this->where('infotype',17)->first();
  44. if(!$data){
  45. return -6010000622;//获取失败
  46. }
  47. return $data->toArray();
  48. }
  49. //虚拟游戏设置信息
  50. function getPrizeSet(){
  51. $data=$this->where('infotype',15)->first();
  52. if(!$data){
  53. return -6010000622;//获取失败
  54. }
  55. return $data->toArray();
  56. }
  57. //获取转账银行信息
  58. function getBankInfo(){
  59. $data=$this->where('infotype',10)->first();
  60. if(!$data){
  61. return -6010000722;//获取失败
  62. }
  63. return $data->toArray();
  64. }
  65. //跑马灯内容
  66. function getRunNotice(){
  67. $data=$this->where('infotype',9)->first();
  68. if(!$data){
  69. return -6010000822;//获取失败
  70. }
  71. return $data->toArray();
  72. }
  73. function getAllSet($where=''){
  74. $data=array(6,9,13,15,16,17,18,19);
  75. if(!empty($where)&&is_array($where)){
  76. $data=$this->where($where)->whereIn('infotype',$data)->get();
  77. }else{
  78. $data=$this->whereIn('infotype',$data)->get();
  79. }
  80. if(!$data){
  81. return -6010000822;//获取失败
  82. }
  83. return $data->toArray();
  84. }
  85. protected function getsInfo($info_type){
  86. $info= $this->getInfo($info_type);
  87. if($info<0){
  88. return $info;
  89. }
  90. return $info['infocontent'];
  91. }
  92. //获取msg
  93. function getInfo($info_type){
  94. $data=$this->where('infotype',$info_type)->first();
  95. if(!$data){
  96. return -6010000122;
  97. }
  98. return $data->toArray();
  99. }
  100. function getInfos($info_type){
  101. $data=$this->where('infotype',$info_type)->get();
  102. if(!$data){
  103. return -6010000122;
  104. }
  105. return $data->toArray();
  106. }
  107. //更新设置
  108. function updateInfo($data,$type){
  109. $data_arr=$this->where('infotype',$type)->first();
  110. if(!$data_arr){
  111. if(!isset($data['infoname'])){
  112. $data['infoname']='新增';
  113. }
  114. $data['identity']=UUID();
  115. $data['infotype']=$type;
  116. $res=$this->insert($data);
  117. }else{
  118. $res=$this->where('infotype',$type)->update($data);
  119. }
  120. if(!$res){
  121. return -7020050022;//更新失败
  122. }
  123. return $res;
  124. }
  125. //添加设置
  126. function addInfo($data){
  127. $data['identity']=UUID();
  128. $res=$this->insert($data);
  129. if(!$res){
  130. return -7020050022;//更新失败
  131. }
  132. return $res;
  133. }
  134. //更新设置
  135. function updateInfos($data,$id){
  136. $res=$this->where('id',$id)->update($data);
  137. if(!$res){
  138. return -7020050022;//更新失败
  139. }
  140. return 1;
  141. }
  142. function checkdata($data,$id){
  143. if(empty($id)){
  144. $arr = $this->where('infoname',$data['infoname'])->where('remarks',$data['remarks'])->first();
  145. if($arr && isset($arr->id)){
  146. $id = $arr->id;
  147. return $this->updateInfos($data,$id);
  148. }
  149. return $this->addInfo($data);
  150. }else{
  151. $arr = $this->where('id',$id)->first();
  152. if (!$arr) {
  153. return -7020050022;//没有数据
  154. }
  155. return $this->updateInfos($data,$id);
  156. }
  157. }
  158. protected function getIPlimit(){
  159. $data=$this->where('infotype',23)->where('status',1)->first();
  160. if(!$data){
  161. return -7022250022;//ip设置关闭
  162. }
  163. return 1;
  164. }
  165. protected function getWebSet(){
  166. $data=$this->where('remarks','recedata')->first();
  167. if(!$data){
  168. return array('infocontent'=>'开游');
  169. }
  170. return $data->toArray();
  171. }
  172. protected function getPath(){
  173. $data=$this->where('infotype',18)->first();
  174. if(!$data){
  175. return -1234;
  176. }
  177. return $data->infocontent;
  178. }
  179. //域名检测 2019-01-16 anton liu
  180. protected function checkDom($dmo)
  181. {
  182. return $this
  183. ->where('infotype','=',1018)
  184. ->where('infocontent','like','%'.$dmo.'%')
  185. ->first();
  186. }
  187. }