Setinfo.php 5.4 KB

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