OrepoolController.class.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <?php
  2. namespace Admin\Controller;
  3. class OrepoolController extends AdminController
  4. {
  5. private $Model;
  6. public function __construct()
  7. {
  8. parent::__construct();
  9. }
  10. //矿池管理列表
  11. public function index(){
  12. $this->display();
  13. }
  14. //添加矿池项目页面
  15. public function addorepool(){
  16. $this->display();
  17. }
  18. //修改矿池项目处理
  19. public function orepoolesave(){
  20. if($_POST){
  21. //ID号
  22. $id = htmlspecialchars(trim(I('post.oid')));
  23. $info = M("orepool")->where(array('id'=>$id))->find();
  24. if(empty($info)){
  25. $this->error("记录不存在");
  26. }
  27. $oretitle = htmlspecialchars(trim(I('post.oretitle')));//矿池名称
  28. if($oretitle == ''){
  29. $this->error("请输入矿池名称");
  30. }
  31. $oreimg = htmlspecialchars(trim(I('post.idimg1'))); //项目图片
  32. if($oreimg == ''){
  33. $this->error("请上传项目图片");
  34. }
  35. $coinname = htmlspecialchars(trim(I('post.coinname'))); //参与币种
  36. if($coinname == ''){
  37. $this->error("请选择参与矿池的币种");
  38. }
  39. $cc_coin = htmlspecialchars(trim(I('post.cc_coin'))); //产出币种
  40. if($cc_coin == ''){
  41. $this->error("请选择矿池产出的币种");
  42. }
  43. $summoney = htmlspecialchars(trim(I('post.summoney')));//矿矿总价值
  44. if($summoney == ''){
  45. $this->error("请输入矿池总价值");
  46. }
  47. $fmoney = htmlspecialchars(trim(I('post.fmoney'))); //模拟进度
  48. if($fmoney == ''){
  49. $this->error("请输入矿池模拟投入金额");
  50. }
  51. $minmoney = htmlspecialchars(trim(I('post.minmoney'))); // 最低投资额度
  52. if($minmoney == ''){
  53. $this->error("请输入单笔最低投资额度");
  54. }
  55. $maxmoney = htmlspecialchars(trim(I('post.maxmoney'))); //最高投资额度
  56. if($maxmoney == ''){
  57. $this->error("请输入单笔最大投资额度");
  58. }
  59. $rtype = htmlspecialchars(trim(I('post.rtype'))); //币释放规则
  60. if($rtype == ''){
  61. $this->error("请选择币释放规则");
  62. }
  63. $sfbl = htmlspecialchars(trim(I('post.sfbl'))); //固定释放比例
  64. if($sfbl == ''){
  65. $this->error("请输入固定释放比例");
  66. }
  67. $gdnum = htmlspecialchars(trim(I('post.gdnum'))); //固定释放额度
  68. if($gdnum == ''){
  69. $this->error("请输入固定释放额度");
  70. }
  71. $gdbl = htmlspecialchars(trim(I('post.gdbl'))); //固定额度比例
  72. if($gdbl == ''){
  73. $this->error("请输入固定额度比例");
  74. }
  75. $rway = htmlspecialchars(trim(I('post.rway'))); //释放方式
  76. if($rway == ''){
  77. $this->error("请选择释放方式");
  78. }
  79. $buytype = htmlspecialchars(trim(I('post.buytype'))); //购买方式
  80. if($buytype == ''){
  81. $this->error("请选择购买方式");
  82. }
  83. $arrmoney = htmlspecialchars(trim(I('post.arrmoney')));
  84. if($arrmoney == ''){
  85. $arrmoney = 0;
  86. }
  87. $buynum = htmlspecialchars(trim(I('post.buynum'))); //单用户购买次数
  88. if($buynum == ''){
  89. $this->error("请输入单用户购买次数");
  90. }
  91. $sort = htmlspecialchars(trim(I('post.sort')));//排序
  92. if($sort == ''){
  93. $this->error("请输入排序编号");
  94. }
  95. $status = htmlspecialchars(trim(I('post.status'))); // 状态
  96. if($status == ''){
  97. $this->error("请输入矿池开放状态");
  98. }
  99. $save['oretitle'] = $oretitle;
  100. $save['oreimg'] = $oreimg;
  101. $save['summoney'] = $summoney;
  102. $save['fmoney'] = $fmoney;
  103. $save['minmoney'] = $minmoney;
  104. $save['maxmoney'] = $maxmoney;
  105. $save['coinname'] = $coinname;
  106. $save['cc_coin'] = $cc_coin;
  107. $save['rtype'] = $rtype;
  108. $save['status'] = $status;
  109. $save['addtime'] = date("Y-m-d H:i:s",time());
  110. $save['buytype'] = $buytype;
  111. $save['arrmoney'] = $arrmoney;
  112. $save['buynum'] = $buynum;
  113. $save['rway'] = $rway;
  114. $save['sfbl'] = $sfbl;
  115. $save['gdnum'] = $gdnum;
  116. $save['gdbl'] = $gdbl;
  117. $save['sort'] = $sort;
  118. $re = M("orepool")->where(array('id'=>$id))->save($save);
  119. if($re){
  120. $this->success("修改成功");exit();
  121. }else{
  122. $this->error("修改失败");exit();
  123. }
  124. }else{
  125. $this->error("网络错误");exit();
  126. }
  127. }
  128. //添加矿池项目处理
  129. public function orepoolsave(){
  130. if($_POST){
  131. $oretitle = htmlspecialchars(trim(I('post.oretitle')));//矿池名称
  132. if($oretitle == ''){
  133. $this->error("请输入矿池名称");
  134. }
  135. $oreimg = htmlspecialchars(trim(I('post.idimg1'))); //项目图片
  136. if($oreimg == ''){
  137. $this->error("请上传项目图片");
  138. }
  139. $coinname = htmlspecialchars(trim(I('post.coinname'))); //参与币种
  140. if($coinname == ''){
  141. $this->error("请选择参与矿池的币种");
  142. }
  143. $cc_coin = htmlspecialchars(trim(I('post.cc_coin'))); //产出币种
  144. if($cc_coin == ''){
  145. $this->error("请选择矿池产出的币种");
  146. }
  147. $summoney = htmlspecialchars(trim(I('post.summoney')));//矿矿总价值
  148. if($summoney == ''){
  149. $this->error("请输入矿池总价值");
  150. }
  151. $fmoney = htmlspecialchars(trim(I('post.fmoney'))); //模拟进度
  152. if($fmoney == ''){
  153. $this->error("请输入矿池模拟投入金额");
  154. }
  155. $minmoney = htmlspecialchars(trim(I('post.minmoney'))); // 最低投资额度
  156. if($minmoney == ''){
  157. $this->error("请输入单笔最低投资额度");
  158. }
  159. $maxmoney = htmlspecialchars(trim(I('post.maxmoney'))); //最高投资额度
  160. if($maxmoney == ''){
  161. $this->error("请输入单笔最大投资额度");
  162. }
  163. $rtype = htmlspecialchars(trim(I('post.rtype'))); //币释放规则
  164. if($rtype == ''){
  165. $this->error("请选择币释放规则");
  166. }
  167. $sfbl = htmlspecialchars(trim(I('post.sfbl'))); //固定释放比例
  168. if($sfbl == ''){
  169. $this->error("请输入固定释放比例");
  170. }
  171. $gdnum = htmlspecialchars(trim(I('post.gdnum'))); //固定释放额度
  172. if($gdnum == ''){
  173. $this->error("请输入固定释放额度");
  174. }
  175. $gdbl = htmlspecialchars(trim(I('post.gdbl'))); //固定额度比例
  176. if($gdbl == ''){
  177. $this->error("请输入固定额度比例");
  178. }
  179. $rway = htmlspecialchars(trim(I('post.rway'))); //释放方式
  180. if($rway == ''){
  181. $this->error("请选择释放方式");
  182. }
  183. $buytype = htmlspecialchars(trim(I('post.buytype'))); //购买方式
  184. if($buytype == ''){
  185. $this->error("请选择购买方式");
  186. }
  187. $arrmoney = htmlspecialchars(trim(I('post.arrmoney')));
  188. if($arrmoney == ''){
  189. $arrmoney = 0;
  190. }
  191. $buynum = htmlspecialchars(trim(I('post.buynum'))); //单用户购买次数
  192. if($buynum == ''){
  193. $this->error("请输入单用户购买次数");
  194. }
  195. $sort = htmlspecialchars(trim(I('post.sort')));//排序
  196. if($sort == ''){
  197. $this->error("请输入排序编号");
  198. }
  199. $status = htmlspecialchars(trim(I('post.status'))); // 状态
  200. if($status == ''){
  201. $this->error("请输入矿池开放状态");
  202. }
  203. $save['oretitle'] = $oretitle;
  204. $save['oreimg'] = $oreimg;
  205. $save['summoney'] = $summoney;
  206. $save['fmoney'] = $fmoney;
  207. $save['minmoney'] = $minmoney;
  208. $save['maxmoney'] = $maxmoney;
  209. $save['coinname'] = $coinname;
  210. $save['cc_coin'] = $cc_coin;
  211. $save['rtype'] = $rtype;
  212. $save['status'] = $status;
  213. $save['addtime'] = date("Y-m-d H:i:s",time());
  214. $save['buytype'] = $buytype;
  215. $save['arrmoney'] = $arrmoney;
  216. $save['buynum'] = $buynum;
  217. $save['rway'] = $rway;
  218. $save['sfbl'] = $sfbl;
  219. $save['gdnum'] = $gdnum;
  220. $save['gdbl'] = $gdbl;
  221. $save['sort'] = $sort;
  222. $re = M("orepool")->add($save);
  223. if($re){
  224. $this->success("添加成功");exit();
  225. }else{
  226. $this->error("添加失败");exit();
  227. }
  228. }else{
  229. $this->error("网络错误");exit();
  230. }
  231. }
  232. //修改矿池项目
  233. public function editorepool(){
  234. $id = trim(I('get.id'));
  235. $info = M("orepool")->where(array('id'=>$id))->find();
  236. $this->assign('info',$info);
  237. $this->display();
  238. }
  239. //删除矿池项目
  240. public function delore(){
  241. if($_GET){
  242. $id = trim(I('get.id'));
  243. $info = M("orepool")->where(array('id'=>$id))->find();
  244. if(empty($info)){
  245. $this->error("该记录不存在");exit();
  246. }
  247. if($info['allmoney'] > 0){
  248. $this->error("已有会员参与该矿池,不能删除");
  249. }
  250. $re = M("orepool")->where(array('id'=>$id))->delete();
  251. if($re){
  252. $this->success("操作成功");exit();
  253. }else{
  254. $this->error("操作失败");exit();
  255. }
  256. }else{
  257. $this->error("非法操作");exit();
  258. }
  259. }
  260. }
  261. ?>